perm filename SYSDEP.TEX[TEX,ALS] blob sn#618949 filedate 1981-10-15 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00009 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	\input dochd4
C00020 00003
C00036 00004
C00059 00005
C00084 00006
C00098 00007
C00146 00008
C00163 00009
C00215 ENDMK
C⊗;
\input dochd4

\def\dispentry#1#2{{}
	\spaceskip 3.333pt plus 10pt minus 2pt
	\xspaceskip 4.444pt plus 11pt minus 3pt
	\parindent 0pt
	$$\hbox par 17pc{\hangindent 1pc after 1\hbox to 1pc{#1\hfil\quad}#2}
	$$
	\parindent 10pt
	}
\def\dispar#1\par{{}
	\spaceskip 3.333pt plus 5pt minus 2pt
	\xspaceskip 4.444pt plus 6pt minus 3pt
	\parindent 0pt
	$$\hbox par 17pc{#1}
	$$
	\parindent 10pt
	}
\def\hide#1{\hbox to 0pt{\hss#1}}
\def\α{\hide{-}\ }
\def\β{\hide{$\bullet$}\ }
\def\runningrighthead#1{\gdef\chead{\:m#1}} %\runningrighthead sets chead
 
\advcount0
\secbegin \head{THE SYSTEM DEPENDENT MODULE OF \TEX}\runninglefthead{\TEX: SYSTEM DEPENDENCIES}
 This module contains all the parts of \TEX\ 
that may need some reprogramming for each different system environment. 
If a compiler does not suport external procedures or there is no interest
in reprogramming them to generate more efficient code, it is possible 
to get by just doing as follows:
\dispar \hide{-} Make all necessary changes in this module.\par
\dispar \hide{-} Modify the beginning sections of \.{TEX.DOC} accordingly.\par
\dispar \hide{-} Delete the first, second and last pages of
 \.{SYSDEP.DOC} (the one file you are now reading).\par
\dispar \hide{-} Put the remaining of this module in the place of the external
procedure declarations in \.{TEX.DOC}.\par
the result will be ready for \.{UNDOC} to produce a single \.{TEX.PAS}
source file.\par
 The data structures declared in \TEX\ have been
designed having in mind a machine and a compiler
that packs fields correctly to the byte. That means that
fields in some records are allocated more space than necessary and, some times,
records take extra words to allocate fields that could have been allocated
in prevously assigned words. But the wasted extra space is not very significant,
and probably does not justify the effort to change the structures here and
in the main module. Rather, the size of the structures should be modified if
the memory space is at premium.
\pascal
\1\3\2\&{program} $\\{sysdep},\45\\{InitStrings},\45\\{ProduceString},\45
\\{AppndString},\45\\{AppndReal},\45\\{InitSysdep}
,\45\\{Release},\45\\{InChTer},\45\\{InLnTer}
,\45\\{OutChErr},\45\\{OutLnErr},\45\\{SendCh},\45
\\{SendLn},\45\\{SendStarted},\45\\{Close},\45\\{Print}
,\45\\{PrintLn},\45\\{PrintInt},\45\\{PrintReal}
,\45\\{PrintFileName},\45\\{PrintOctal},\45
\\{InLn},\45\\{GetFirstLine},\45\\{ForceBufferOut}
,\45\\{TraceLine},\45\\{DeclareOFil},\45\\{InitFileName}
,\45\\{AppendToName},\45\\{ReadFontInfo},\45
\\{DvI},\45\\{IntOut},\45\\{CloseOut},\45\\{SetTableSizes}
,\45\\{WriteSecondMem},\45\\{WriteEqTb}
,\45\\{WriteHyphenTb},\45\\{WritePageTb},\45\\{WriteDelimTb}
,\45\\{WriteFMem},\45\\{GetTableSizes}
,\45\\{InitSecondMem},\45\\{InitEqTb},\45\\{InitHyphenTb}
,\45\\{InitPageTb},\45\\{InitDelimTb},\45
\\{InitFMem}$\1;
\3\2\1\&{const} $\null$\6Constants in the outer block{ \:m13\7}$\null 
$
\3\2\1\&{type} $\null$\6Types in the outer block{ \:m5\7}$\null $
\3\2\1\&{var} $\null$\6Globals in the outer block{ \:m15\7}$\null 
$

\secbegin Definitions for the memory of \TEX
\pascal
\1\3\2\1\&{define} \\{memsize} $=$ $49152\null$\40\ $\{\;$size of the main memory structure of \TEX$\;\}$
$\null
$
\3\2\1\&{define} \\{secondmem} $=$ $25012\null$\40\ $\{\;$size of the part of the main memory used in single node blocks$\;\}$
$\null
$

\secbegin Definitions for the table of equivalents
\pascal
\1\3\2\1\&{define} \\{hprime} $=$ $89\null$\40\ $\{\;$range of hash values$\;\}$
$\null
$
\3\2\1\&{define} \\{hashsize} $=$ $1009\null$\40\ $\{\;$hash table size, must be prime and $<2↑{bound\ of\ \\{sixteenbits}-127}$$\;\}$
$\null
$
\3\2\1\&{define} \\{texpars} $=$ $21\null$\40\ $\{\;$number of distinct parameters settable by \.{\\chpar}$\;\}$
$\null
$
\3\2\1\&{define} \\{locs} $=$ $23\null$\40\ $\{\;$values of local quantities (\.{\\:},\.{\\baselineskip}, etc.)$\;\}$
$\null
$
\3\2\1\&{define} \\{eqtbsize} $=$ $\\{hashsize}+128+128+128+15+\\{texpars}\null$\40\ $\{\;$size of table for current values$\;\}$
$\null
$

\secbegin Next follows a list of constants that can be adjusted for each installation
\pascal
\1\3\2\1\&{define} \\{stacksize} $=$ $80\null$\40\ $\{\;$size of input stacks$\;\}$
$\null
$
\3\2\1\&{define} \\{pagememsize} $=$ $8\null$\40\ $\{\;$number of page parameters$\;\}$
$\null
$
\3\2\1\&{define} \\{nfonts} $=$ $64\null$\40\ $\{\;$number of fonts allowed (must not be greater than 256)$\;\}$
$\null
$
\3\2\1\&{define} \\{maxfnt} $=$ $\\{nfonts}-1\null$\40\ $\{\;$highest font number$\;\}$
$\null
$
\3\2\1\&{define} \\{charsperfont} $=$ $128\null$\40\ $\{\;$assumed number of characters in a font$\;\}$
$\null
$
\3\2\1\&{define} \\{maxinfil} $=$ $6\null$\40\ $\{\;$maximum number of input files that can be open at the
							same time$\;\}$
$\null
$
\3\2\1\&{define} \\{maxfil} $=$ $\\{nfonts}+10+\\{maxinfil}\null$\40\ $\{\;$maximum number of file names \TEX\ remembers$\;\}$
$\null
$
\3\2\1\&{define} \\{bufsize} $=$ $200\null$\40\ $\{\;$size of the input buffer$\;\}$
$\null
$
\3\2\1\&{define} \\{maxlinelength} $=$ $150\null$\40\ $\{\;$maximum number of characters accepted
			 in a line of a file$\;\}$
$\null
$
\3\2\1\&{define} \\{exceptableEntryLength} $=$ $2\null$\40\ $\{\;$size of exceptable entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{excephyphEntryLength} $=$ $2\null$\40\ $\{\;$size of excephyph entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{suffixEntryLength} $=$ $3\null$\40\ $\{\;$size of suffix entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{prefixEntryLength} $=$ $3\null$\40\ $\{\;$size of prefix entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{btableEntryLength} $=$ $3\null$\40\ $\{\;$size of btable entry in words$\;\}$
$\null
$
\3\2\1\&{define} \\{readoutsize} $=$ $3\null$\40\ $\{\;$maximum size of the above$\;\}$
$\null
$
\3\2\1\&{define} \\{excepsize} $=$ $373\null$\40\ $\{\;$length of hyphenation tables: there should always
			 some slack in the exception table to allow for
			 efficient hashing;  since it is used as the hash
			 modulo, the length should always be prime$\;\}$
$\null
$
\3\2\1\&{define} \\{sufsize} $=$ $116$
\3\2\1\&{define} \\{prefsize} $=$ $109$
\3\2\1\&{define} \\{btabsize} $=$ $30$
\3\2\1\&{define} \\{fmemsize} $=$ $6400\null$\40\ $\{\;$size of font memory for secondary tables$\;\}$
$\null
$
\3\2\1\&{define} \\{fontinfosize} $=$ $8192\null$\40\ $\{\;$$\\{nfonts}\times 128$$\;\}$
$\null
$
\3\2\1\&{define} \\{bytesPerWord} $=$ $4\null$\40\ $\{\;$valid both for 32 and 36 bits per word$\;\}$
$\null
$

\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{oneOfTwo}=1\mathrel{\!.\,.\!}2$;
\2$\\{oneOfFour}=1\mathrel{\!.\,.\!}4$;
\2$\\{oneOfFive}=1\mathrel{\!.\,.\!}5$;
\2$\\{oneOfSix}=1\mathrel{\!.\,.\!}6$;\40\ $\{\;$these types are useful in more complicated declarations.$\;\}$


\note See also sections 8, 11, 24, 31, 58, 71, 73,  and 74.

\note This code is used in section 1.

\secbegin Ascii codes for some characters not recognized by the preprocessor
\pascal
\1\3\2\1\&{define} \\{null} $=$ $\hbox{\char'16}0$
\3\2\1\&{define} \\{linefeed} $=$ $\hbox{\char'16}12$
\3\2\1\&{define} \\{formfeed} $=$ $\hbox{\char'16}14$
\3\2\1\&{define} \\{carriagereturn} $=$ $\hbox{\char'16}15$
\3\2\1\&{define} \\{zero} $=$ $\hbox{\char'16}60$
\3\2\1\&{define} \\{one} $=$ $\hbox{\char'16}61$
\3\2\1\&{define} \\{two} $=$ $\hbox{\char'16}62$
\3\2\1\&{define} \\{three} $=$ $\hbox{\char'16}63$
\3\2\1\&{define} \\{four} $=$ $\hbox{\char'16}64$
\3\2\1\&{define} \\{five} $=$ $\hbox{\char'16}65$
\3\2\1\&{define} \\{six} $=$ $\hbox{\char'16}66$
\3\2\1\&{define} \\{seven} $=$ $\hbox{\char'16}67$
\3\2\1\&{define} \\{eight} $=$ $\hbox{\char'16}70$
\3\2\1\&{define} \\{nine} $=$ $\hbox{\char'16}71$

\secbegin \head{The basic record employed by \TEX}\par
 Most of \TEX's data structures are built on top of a single record
structure which is expected to be efficiently stored and accessed in
most systems. That record is declared below.
\pascal
\1\3\2\1\&{define} \\{eightbits} $≡$ $0\mathrel{\!.\,.\!}255\null$\40\ $\{\;$an 8-bit field$\;\}$
$\null
$
\3\2\1\&{define} \\{sixteenbits} $≡$ $0\mathrel{\!.\,.\!}65535\null$\40\ $\{\;$a 16-bit field$\;\}$
$\null
$

\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{halves2}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0$\\{lhword}\mathrel:\\{sixteenbits}$;
\2\1\&{case} $\\{oneOfTwo}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{rhword}\mathrel:\\{sixteenbits}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{byte2}\mathrel:\\{eightbits}$;
\2$\\{byte3}\mathrel:\\{eightbits}$)
\3\3\2\&{end}$\null\3
$;
\2$\\{bytes4}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0$\\{byte0}\mathrel:\\{eightbits}$;
\2$\\{byte1}\mathrel:\\{eightbits}$;
\2\1\&{case} $\\{oneOfTwo}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{rhword}\mathrel:\\{sixteenbits}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{byte2}\mathrel:\\{eightbits}$;
\2$\\{byte3}\mathrel:\\{eightbits}$)
\3\3\2\&{end}$\null\3
$;
\2$\\{memoryword}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0\1\&{case} $\\{oneOfFour}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{pts}\mathrel:\\{real}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{int}\mathrel:\\{integer}$)
\3;
\2\1$3\mathrel:\null$
(\0$\\{twohalves}\mathrel:\\{halves2}$)
\3;
\2\1$4\mathrel:\null$
(\0$\\{fourbytes}\mathrel:\\{bytes4}$)
\3\3\2\&{end}$\null\3
$;


\secbegin The following are definitions, types and globals employed all over
  the program. Corresponding definitions appear at the beginning of the main
module of \TEX.
 Syntactic sugar first
\pascal
\1\3\2\1\&{define} \\{continue} $=$ $10\null$\40\ $\{\;$end of body of loop$\;\}$
$\null
$
\3\2\1\&{define} \\{return} $=$ $50\null$\40\ $\{\;$go here to exit a procedure$\;\}$
$\null
$
\3\2\1\&{define} \\{done} $=$ $0\null$\40\ $\{\;$some labels for loop exits$\;\}$
$\null
$
\3\2\1\&{define} \\{done1} $=$ $1$
\3\2\1\&{define} \\{done2} $=$ $2$
\3\2\1\&{define} \\{failure} $=$ $1$
\3\2\1\&{define} \\{malformedname} $=$ $2$
\3\2\1\&{define} \\{needmore} $=$ $3$

\secbegin \6Loop exits{ \:m10\7} \.{+=}\par
\pascal
\2$\\{done}$
\3\2\1\&{define} \\{terminal} $≡$ $-1\null$\40\ $\{\;$identifier for the terminal$\;\}$
$\null
$
\3\2\1\&{define} \\{inputFile} $≡$ $-2\null$\40\ $\{\;$identifier for the {\it current} input file$\;\}$
$\null
$
\3\2\1\&{define} \\{outputFile} $≡$ $-3\null$\40\ $\{\;$identifier for the output file$\;\}$
$\null
$
\3\2\1\&{define} \\{dummyFont} $=$ $\\{maxfnt}+1$
\3\2\1\&{define} \\{filnam}\.{(\char'43)} $≡$ $(-(\.{\char'43})-2)\null$\40\ $\{\;$indices \\f in the \\{fileName} array are usually
			passed as \\{filnam}(\\f) to procedures dealing with
			strings, to help them find out whether the argument
			should be located in the \\{fileName} array or in
			the \\{strngpool}$\;\}$
$\null
$
\3\2\1\&{define} \\{stringsize} $=$ $64\null$\40\ $\{\;$size of a printable message$\;\}$
$\null
$

\note This code is used in section 50.


\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{asciiCode}=0\mathrel{\!.\,.\!}127$;\40\ $\{\;$7-bit \&{ascii}$\;\}$
\2$\\{asciiString}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{stringsize}-1]
\mathop{\&{\ of }\!}
\\{asciiCode}
$;
\2$\\{packedAsciiString}=\mathop{\&{packed }\!}\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{stringsize}-1]
\mathop{\&{\ of }\!}
\\{asciiCode}
$;
\3\2\1\&{define} \\{Increment}\.{(\char'43)} $≡$ $\.{\char'43}\mathrel:=\.{\char'43}+1$
\3\2\1\&{define} \\{Decrement}\.{(\char'43)} $≡$ $\.{\char'43}\mathrel:=\.{\char'43}-1$
\3\2\1\&{define} \\{UpperCase}\.{(\char'43)} $≡$ \2\&{begin} \0\1\&{if} $(\.{\char'43}>=\.{{\rm``}a{\rm''}})\mathbin{\&{and}}
(\.{\char'43}<=\.{{\rm``}z{\rm''}})$ \&{then}
\0$\.{\char'43}\mathrel:=\.{\char'43}-32$\3
\2\&{end}\40\ $\{\;$change lower case to upper case$\;\}$
\3\2\1\&{define} \\{LowerCase}\.{(\char'43)} $≡$ \2\&{begin} \0\1\&{if} $(\.{\char'43}>=\.{{\rm``}A{\rm''}})\mathbin{\&{and}}
(\.{\char'43}<=\.{{\rm``}Z{\rm''}})$ \&{then}
\0$\.{\char'43}\mathrel:=\.{\char'43}+32$\3
\2\&{end}\40\ $\{\;$change upper case to lower case$\;\}$
\3\2\1\&{define} \\{spacer} $=$ $10\null$\40\ $\{\;$type of characters treated as blank space$\;\}$
$\null
$
\3\2\1\&{define} \\{letter} $=$ $11\null$\40\ $\{\;$type of characters treated as letters$\;\}$
$\null
$
\3\2\1\&{define} \\{otherchar} $=$ $12\null$\40\ $\{\;$none of the above character types$\;\}$
$\null
$
\3\2\1\&{define} \\{charcodes} $=$ $\\{otherchar}+1\null$\40\ $\{\;$number of distinct codes allowed in \\{chartype}$\;\}$
$\null
$

\secbegin The following definitions belong exclusively to the system dependent part
of the program.
First come file, directory and device names as employed in the WAITS system
to designate external files. For each particular installations different
naming conventions may be needed.
\pascal
\1\3\2\1\&{define} \\{errfilnam} $≡$ $\.{'ERRORSTEM'}\null$\40\ $\{\;$the disk file where error messages are saved$\;\}$
$\null
$
\3\2\1\&{define} \\{outfilnam} $≡$ $\.{'TEXOUTDVI'}\null$\40\ $\{\;$name of output \.{.DVI} disk file$\;\}$
$\null
$
\3\2\1\&{define} \\{tblfilnam} $≡$ $\.{'PTEXINTBL'}\null$\40\ $\{\;$disk file from where initial contents of \TEX\ tables are read$\;\}$
$\null
$
\3\2\1\&{define} \\{ascfilnam} $≡$ $\.{'ASCII\ TBL'}\null$\40\ $\{\;$disk file containing 128 printable strings for the 128 ascii characters$\;\}$
$\null
$
\3\2\1\&{define} \\{strfilnam} $≡$ $\.{'STRINITBL'}\null$\40\ $\{\;$this disk file contains the strings appearing in \TEX's code$\;\}$
$\null
$
\3\2\1\&{define} \\{terfilnam} $≡$ $\.{'FOOBARTTY'}\null$\40\ $\{\;$name of the terminal, as an external file$\;\}$
$\null
$
\3\2\1\&{define} \\{libraryarea} $≡$ $244570637163\mathopen{\hbox{B}}+400000000000\mathopen{\hbox{B}}
\null$\40\ $\{\;$SIXBIT code for directory {\bf [TEX,SYS]}$\;\}$
$\null
$

\secbegin \6Constants in the outer block{ \:m13\7} \.{+=}\par
\pascal
\2$\\{terDevice}=\.{'TTY\ \ \ '}$;\40\ $\{\;$\.{'TER\ \ \ '} for DEBUGging purposes only,
				in case the \.{PASCAL} debugger uses the terminal
				(\.{TTY:}) as
				standard i/o device. It should be changed
				to \.{'TTY\ \ \ '} when not debugging.$\;\}$


\note This code is used in section 1.

\secbegin Next come the identifiers for the internal files, whose external file names
were given above.

\secbegin \6Globals in the outer block{ \:m15\7} \.{+=}\par
\pascal
\2$\\{terOut}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;\40\ $\{\;$the terminal as an \&{ascii} output file$\;\}$
\2$\\{terIn}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;\40\ $\{\;$the terminal as an \&{ascii} input file$\;\}$
\2$\\{errfil}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;\40\ $\{\;$the errors file as an \&{ascii} output file$\;\}$
\2$\\{fontfil}\mathrel:\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{memoryword}$;\40\ $\{\;$the font information file$\;\}$
\2$\\{outfil}\mathrel:\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{integer}$;\40\ $\{\;$the output \.{.DVI} file$\;\}$
\2$\\{tblfil}\mathrel:\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{integer}$;\40\ $\{\;$the file from where the initial contents of the
			 system tables are read$\;\}$
\2$\\{fileName}\mathrel:\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{maxfil}]\mathop{\&{\ of }\!}
\\{packedAsciiString}
$;\40\ $\{\;$names of files known to \TEX$\;\}$
\2$\\{filPtr}\mathrel:\\{integer}$;\40\ $\{\;$pointer to first free entry in \\{fileName}$\;\}$
\2$\\{fourbytemask}\mathrel:\\{integer}$;\40\ $\{\;$mask used to generate 2's complement numbers in 32 bits$\;\}$


\note See also sections 18, 25, 27, 52,  and 66.

\note This code is used in section 1.

\secbegin The maximum and minimum functions are not standard in PASCAL. Here they
are defined for \&{integer} arguments and result only.
\pascal
\1\3\2\1\1\&{function} $\\{intmax}(\\{x},\45\\{y}\mathrel:\\{integer})\mathrel:
\\{integer}$;
\3\2\&{begin} \0\1\&{if} $\\{x}>\\{y}$ \&{then}
\0$\\{intmax}\mathrel:=\\{x}$\3
\2\&{else} \0$\\{intmax}\mathrel:=\\{y}$
;
\2\&{end};
\3\2\1\1\&{function} $\\{intmin}(\\{m},\45\\{n}\mathrel:\\{integer})\mathrel:
\\{integer}$;
\3\2\&{begin} \0\1\&{if} $\\{m}>\\{n}$ \&{then}
\0$\\{intmin}\mathrel:=\\{n}$\3
\2\&{else} \0$\\{intmin}\mathrel:=\\{m}$
;
\2\&{end};


\secbegin \head{The string handler}
Most PASCAL compilers will not support a whole set of ascii characters
nor any but fixed length strings. That is troublesome because the
object of \TEX's manipulations are precisely characters and strings.
Keeping in mind that \TEX\ reads and writes characters
as 7-bit ascii codes, we approach the problem in two ways:
\dispar
\hide{-} Strings known at compile time are replaced by integers by the preprocessor,
which saves the strings in a file (\.{STRINI.TBL} at WAITS) so that
they can be preloaded by this module in the most convenient way.
 When needed, the main \TEX\ module will call \\{Print} if it wants
a string to be printed or \\{ProduceString} if it wants the string
itself for some other purpose. Presently, strings are kept in a
\\{strngpool} and an associated array of string pointers.\par
\dispar
\hide{-} Anything read from a file or the terminal is treated in a character
by character basis using the procedures in the following chapter.
For each system, there should be a file (which at WAITS is
called \.{ASCII.TBL}) that contains one string for each ascii character
indicating how the character should be printed.\par

\secbegin \6Globals in the outer block{ \:m15\7} \.{+=}\par
\pascal
\2$\\{strng}\mathrel:\mathop{\&{array }}[-1\mathrel{\!.\,.\!}999]\mathop{\&{\ of }\!}
\\{integer}$;\40\ $\{\;$indexes into the \\{strngpool}$\;\}$
\2$\\{strngpool}\mathrel:\mathop{\&{packed }\!}\mathop{\&{array }}[-1\mathrel{\!.\,.\!}6000]\mathop{\&{\ of }\!}
\\{asciiCode}
$;
\2$\\{strnginx}\mathrel:\\{integer}$;\40\ $\{\;$points into the \\{strng} array$\;\}$
\2$\\{poolinx}\mathrel:\\{integer}$;\40\ $\{\;$points into the \\{strngpool} array$\;\}$


\secbegin The procedure \\{InitStrings} reads the ascii-table and the printable strings
into \\{strngpool} and \\{strng}.  At WAITS, lines are terminated by <cr>.
\pascal
\1\3\2\1\1\&{procedure} $\\{InitStrings}$;
\3\2\1\&{label} \0\\{continue},\45\ \0\\{done};
\3\2\1\&{var} $\\{c}\mathrel:\\{asciiCode}$;
\2$\\{chartable}\mathrel:\\{boolean}$;
\3\2\&{begin} \0$\\{strng}[-1]\mathrel:=-1$;
\0$\\{strngpool}[-1]\mathrel:=\\{null}$;\40\
$\{\;$true null$\;\}$
\2$\\{strng}[0]\mathrel:=0$;
\0$\\{strnginx}\mathrel:=1$;
\0$\\{poolinx}\mathrel:=0$;
\0$\\{reset}(\\{ichan1},\45\\{ascfilnam},\450,\45\\{libraryarea}
)
$;
\0$\\{chartable}\mathrel:=\\{true}$;
\2\\{continue}: \0\1\&{while} $\mathop{\&{not }\!}\\{eof}(\\{ichan1})$ \&{do}
\2\&{begin} \0$\\{c}\mathrel:=\\{ord}(\\{ichan1}{\up})$;
\2\1\&{while} $\\{c}=\\{null}$ \&{do}
\2\&{begin} \0$\\{get}(\\{ichan1})$;
\0$\\{c}\mathrel:=\\{ord}(\\{ichan1}{\up})$
\2\&{end}\3
;
\2\1\&{while} $(\\{c}=\\{carriagereturn})\mathbin{\&{or}}(\\{c}=\\{formfeed})
$ \&{do}
\2\&{begin} \0$\\{strngpool}[\\{poolinx}]\mathrel:=\\{null}$;
\0$\\{Increment}(\\{poolinx})$;\40\
$\{\;$set delimiting \\{null}$\;\}$
\2$\\{strng}[\\{strnginx}]\mathrel:=\\{poolinx}$;
\0$\\{Increment}(\\{strnginx})$;\40\
$\{\;$pointer to first character of next string$\;\}$
\2\1\&{repeat} \0$\\{get}(\\{ichan1})$;
\2\1\&{if} $\\{eof}(\\{ichan1})$ \&{then}
\0$\mathop{\&{goto }\!}\\{done}$\3
;
\2$\\{c}\mathrel:=\\{ord}(\\{ichan1}{\up})$
\3\2\&{until} $(\\{c}<>\\{linefeed})\mathbin{\&{and}}(\\{c}<>\\{null})
$;\40\
$\{\;$skip \\{linefeed}s and \\{null}s$\;\}$
\2\&{end}\3
;
\2$\\{strngpool}[\\{poolinx}]\mathrel:=\\{c}$;
\0$\\{Increment}(\\{poolinx})$;
\0$\\{get}(\\{ichan1})$
\2\&{end}\3
;
\2\\{done}: \0\1\&{if} $\\{chartable}$ \&{then}
\2\&{begin} \0$\\{chartable}\mathrel:=\\{false}$;
\0$\\{reset}(\\{ichan1},\45\\{strfilnam},\450,\45\\{libraryarea}
)
$;
\0$\mathop{\&{goto }\!}\\{continue}$
\2\&{end}\3
;
\2$\\{reset}(\\{ichan1})$;
\2\&{end};


\secbegin The procedure \\{ProduceString} will return a string in \\{namestring}.
If $\\c≤\\{filnam}(0)$ then this string is obtained from the \\{strngpool} using \\c
as an index, otherwise it is the name of font number \\c.
\pascal
\1\3\2\1\1\&{procedure} $\\{ProduceString}(\\{c}\mathrel:\\{integer};\42\,\mathop{\&{var}}\\{namestring}
\mathrel:
\\{asciiString}
)
$;
\3\2\1\&{var} $\\{i},\45\\{j}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{if} $\\{c}<=\\{filnam}(0)$ \&{then}\40\
$\{\;$get the name of the file from \\{fileName}$\;\}$
\2$\\{Unpack}(\\{fileName}[\\{filnam}(\\{c})],\45\\{namestring},\45
0
)
$\3
\2\&{else} \1\&{begin} \0$\\{i}\mathrel:=-1$;
\0$\\{j}\mathrel:=\\{strng}[\\{c}]-1$;
\2\1\&{repeat} \0$\\{Increment}(\\{j})$;
\0$\\{Increment}(\\{i})$;
\0$\\{namestring}[\\{i}]\mathrel:=\\{strngpool}[\\{j}]
$
\3\2\&{until} $\\{strngpool}[\\{j}]=\\{null}$
\2\&{end}\3
\2\&{end};


\secbegin The procedure \\{AppndString} appends string \\s to string \\d.
 If $\\s≤filnam(0)$ then the corresponding string can be
found in the \\{fileName} array, otherwise it is an ordinary string
in \\{strngpool}. If $\\d>\\{filnam}(0)$ this procedure does not append but instead
creates a new string at the end of the \\{strng} and \\{strngpool} arrays and
fills it with the contents of the source.
In any case, the function returns an identifier for the string in the
fashion of strings accepted by \\{ProduceString}.
\pascal
\1\3\2\1\1\&{function} $\\{AppndString}(\\{d},\45\\{s}\mathrel:\\{integer})
\mathrel:\\{integer}$;
\3\2\1\&{var} $\\{i},\45\\{j}\mathrel:\\{integer}$;
\2$\\{sstring},\45\\{dstring}\mathrel:\\{asciiString}$;
\3\2\&{begin} \0$\\{ProduceString}(\\{s},\45\\{sstring})$;
\0$\\{i}\mathrel:=-1$;\40\
$\{\;$initialize index into \\{sstring}$\;\}$
\2\1\&{if} $\\{d}<=\\{filnam}(0)$ \&{then}\40\
$\{\;$string to append to is a file name$\;\}$
\2\&{begin} \0$\\{Unpack}(\\{fileName}[\\{filnam}(\\{d})],\45\\{dstring},\45
0
)
$;
\0$\\{j}\mathrel:=0$;\40\
$\{\;$initialize index into \\{dstring}$\;\}$
\2\1\&{while} $\\{dstring}[\\{j}]<>\\{null}$ \&{do}
\0$\\{Increment}(\\{j})$\3
;\40\
$\{\;$get to end of string$\;\}$
\2\1\&{repeat} \0$\\{Increment}(\\{i})$;
\0$\\{dstring}[\\{j}]\mathrel:=\\{sstring}[\\{i}]$;
\0$\\{Increment}(\\{j})$;
\3\2\&{until} $\\{sstring}[\\{i}]=\\{null}$;
\2$\\{pack}(\\{dstring},\450,\45\\{fileName}[\\{filnam}(\\{d})]
)
$;
\0$\\{AppndString}\mathrel:=\\{d}$;
\2\&{end}\3
\2\&{else} \1\&{begin} \40\ $\{\;$create a new string in \\{strngpool}$\;\}$
\2\1\&{repeat} \0$\\{Increment}(\\{i})$;
\0$\\{strngpool}[\\{poolinx}]\mathrel:=\\{sstring}[\\{i}]
$;
\0$\\{Increment}(\\{poolinx})$;
\3\2\&{until} $\\{sstring}[\\{i}]=\\{null}$;
\2$\\{strng}[\\{strnginx}]\mathrel:=\\{poolinx}$;
\0$\\{Increment}(\\{strnginx})$;
\0$\\{AppndString}\mathrel:=\\{strnginx}-2$;
\2\&{end}\3
\2\&{end};


\secbegin The function \\{AppndReal} appends the real number \\s to string \\d.
The rules for \\d and the returned value are the same as those in \\{AppndString}.
Before appending, the real number \\s is converted to a string of five
characters that has a decimal point in the fourth position. As \\s will
always be positive, there's no need for a sign. For example, the string obtained
from $3/2$ is precisely ``<space><space>1.5''.
\pascal
\1\3\2\1\1\&{function} $\\{AppndReal}(\\{d}\mathrel:\\{integer};\42\,\\{s}\mathrel:\\{real}
)
\mathrel:\\{integer}$;
\3\2\1\&{var} $\\{i},\45\\{j}\mathrel:\\{integer}$;
\2$\\{sstring},\45\\{dstring}\mathrel:\\{asciiString}$;
\3\2\&{begin} \0$\\{i}\mathrel:=\\{trunc}((\\{s}+0.05){\ast}10)$;
\0$\\{sstring}[5]\mathrel:=\\{null}$;\40\
$\{\;$string delimiter$\;\}$
\2$\\{sstring}[4]\mathrel:=(\\{i}\mathbin{\&{mod}}10)+
\.{{\rm``}0{\rm''}}$;
\0$\\{i}\mathrel:=\\{i}\mathbin{\&{div}}10$;
\0$\\{sstring}[3]\mathrel:=\.{{\rm``}.{\rm''}}$;
\2\1\&{for} $\\{j}\mathrel:=2\mathrel{\&{downto}}0$ \&{do}
\2\1\&{if} $\\{i}>0$ \&{then}
\2\&{begin} \0$\\{sstring}[\\{j}]\mathrel:=(\\{i}\mathbin{\&{mod}}10)
+\.{{\rm``}0{\rm''}}$;
\0$\\{i}\mathrel:=\\{i}\mathbin{\&{div}}10$;
\2\&{end}\3
\2\&{else} \0$\\{sstring}[\\{j}]\mathrel:=\.{{\rm``}\ {\rm''}}$
\3
;
\2$\\{i}\mathrel:=-1$;\40\
$\{\;$initialize index into \\{sstring}$\;\}$
\2\1\&{if} $\\{d}<=\\{filnam}(0)$ \&{then}\40\
$\{\;$string to append to is a file name$\;\}$
\2\&{begin} \0$\\{Unpack}(\\{fileName}[\\{filnam}(\\{d})],\45\\{dstring},\45
0
)
$;
\0$\\{j}\mathrel:=0$;\40\
$\{\;$initialize index into \\{dstring}$\;\}$
\2\1\&{while} $\\{dstring}[\\{j}]<>\\{null}$ \&{do}
\0$\\{Increment}(\\{j})$\3
;\40\
$\{\;$get to end of string$\;\}$
\2\1\&{repeat} \0$\\{Increment}(\\{i})$;
\0$\\{dstring}[\\{j}]\mathrel:=\\{sstring}[\\{i}]$;
\0$\\{Increment}(\\{j})$;
\3\2\&{until} $\\{sstring}[\\{i}]=\\{null}$;
\2$\\{pack}(\\{dstring},\450,\45\\{fileName}[\\{filnam}(\\{d})]
)
$;
\0$\\{AppndReal}\mathrel:=\\{d}$;
\2\&{end}\3
\2\&{else} \1\&{begin} \40\ $\{\;$create a new string in \\{strngpool}$\;\}$
\2\1\&{repeat} \0$\\{Increment}(\\{i})$;
\0$\\{strngpool}[\\{poolinx}]\mathrel:=\\{sstring}[\\{i}]
$;
\0$\\{Increment}(\\{poolinx})$;
\3\2\&{until} $\\{sstring}[\\{i}]=\\{null}$;
\2$\\{strng}[\\{strnginx}]\mathrel:=\\{poolinx}$;
\0$\\{Increment}(\\{strnginx})$;
\0$\\{AppndReal}\mathrel:=\\{strnginx}-2$;
\2\&{end}\3
\2\&{end};


\secbegin \head{Basic I/O procedures }
\pascal
\1\3\2\1\1\&{procedure} $\\{InitSysdep}(\mathop{\&{var}}\\{fourbyteSize}\mathrel:\\{integer}
)
$;\40\ $\{\;$initializes output devices$\;\}$
\3\2\1\&{var} $\\{i}\mathrel:\\{integer}$;
\3\2\&{begin} \40\ $\{\;$We want \\{fourbyteSize} to be such that when $\\{amt}<0$ then
$\\{amt}:=\\{amt}+\\{fourbyteSize}$ is the 32-bit 2's-complement of \\{amt}. This
is achieved with $\\{fourbyteSize}=0$ in systems with integer representation in
32-bit or with $\\{fourbyteSize}='40000000000$ in systems with larger integer range.
 \\{maxint} is a standard (system dependent) integer that should help determine
the value of \\{fourbyteSize}.$\;\}$
\2\1\&{if} $\\{maxint}>17777777777\mathopen{\hbox{B}}$ \&{then}
\0$\\{fourbyteSize}\mathrel:=40000000000\mathopen{\hbox{B}}
$\3
\2\&{else} \0$\\{fourbyteSize}\mathrel:=0$
;\40\
$\{\;$0 for 32-bit machines$\;\}$
\2$\\{fourbytemask}\mathrel:=\\{fourbyteSize}$;
\0$\\{rewrite}(\\{terOut},\45\\{terfilnam},\450,\450,\45\\{terDevice}
)
$;\40\
$\{\;$open terminal for ascii output$\;\}$
\2$\\{rewrite}(\\{errfil},\45\\{errfilnam})$;\40\
$\{\;$open the errors file$\;\}$
\2\1\&{for} $\\{i}\mathrel:=0\mathrel{\&{to}}\\{nfonts}$ \&{do}
\0$\\{fileName}[\\{i},\450]\mathrel:=\\{null}$\3
;\40\
$\{\;$clear all font names$\;\}$
\2$\\{filPtr}\mathrel:=10+\\{nfonts}+1$;\40\
$\{\;$location of the name of the first input file$\;\}$
\2$\\{bytenum}\mathrel:=1$;
\0$\\{dviword}.\\{int}\mathrel:=0$;\40\
$\{\;$first word to go to output file is still empty$\;\}$
\2\&{end};


\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{char9}=\mathop{\&{packed }\!}\mathop{\&{array }}[1\mathrel{\!.\,.\!}9]\mathop{\&{\ of }\!}
\\{char}
$;\40\ $\{\;$pascal does not take the type
					declaration in the parameter part
					of a procedure declaration$\;\}$
\2$\\{char6}=\mathop{\&{packed }\!}\mathop{\&{array }}[1\mathrel{\!.\,.\!}6]\mathop{\&{\ of }\!}
\\{char}
$;\40\ $\{\;$logical device name$\;\}$


\secbegin \6Globals in the outer block{ \:m15\7} \.{+=}\par
\pascal
\2$\\{ichan1}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ichan2}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ichan3}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ichan4}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ichan5}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ichan6}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;\40\ $\{\;$Input files.
NOTE: SYSDEP uses ICHANx with x in the range [1..6] because of the existence of a
compiler imposed limit on the number of files that a PASCAL program can keep open.
This is clearly a system dependent parameter. Six input files may not be enough
for some complicated TEX sources.$\;\}$


\secbegin The procedures below ressemble standard PASCAL statements, but they take
\&{integer} input file designators instead of \&{file} arguments.
\pascal
\1\3\2\1\1\&{procedure} $\\{RsetFile}(\\{id}\mathrel:\\{integer};\42\,\\{fname}\mathrel:
\\{char9}
;\42\,
\\{fdirectory}
\mathrel:
\\{integer}
;\42\,
\\{fdevice}
\mathrel:
\\{char6}
)
$;\40\ $\{\;$Like \&{reset}.$\;\}$
\3\2\&{begin} \0\1\&{case} $\\{id}$ \&{of}
\2\11: \0$\\{reset}(\\{ichan1},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\12: \0$\\{reset}(\\{ichan2},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\13: \0$\\{reset}(\\{ichan3},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\14: \0$\\{reset}(\\{ichan4},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\15: \0$\\{reset}(\\{ichan5},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\16: \0$\\{reset}(\\{ichan6},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3
\2\&{end}\3
\2\&{end};
\3\2\1\1\&{function} $\\{eofChan}(\\{id}\mathrel:\\{integer})\mathrel:\\{boolean}
$;\40\ $\{\;$Like \\{RsetFile}, for \&{eof}$\;\}$
\3\2\&{begin} \0\1\&{case} $\\{id}$ \&{of}
\2\11: \0$\\{eofChan}\mathrel:=\\{eof}(\\{ichan1})$\3;
\2\12: \0$\\{eofChan}\mathrel:=\\{eof}(\\{ichan2})$\3;
\2\13: \0$\\{eofChan}\mathrel:=\\{eof}(\\{ichan3})$\3;
\2\14: \0$\\{eofChan}\mathrel:=\\{eof}(\\{ichan4})$\3;
\2\15: \0$\\{eofChan}\mathrel:=\\{eof}(\\{ichan5})$\3;
\2\16: \0$\\{eofChan}\mathrel:=\\{eof}(\\{ichan6})$\3
\2\&{end}\3
\2\&{end};
\3\2\1\1\&{procedure} $\\{GetChan}(\\{id}\mathrel:\\{integer})$;\40\ $\{\;$Like \&{get}.$\;\}$
\3\2\&{begin} \0\1\&{case} $\\{id}$ \&{of}
\2\11: \0$\\{get}(\\{ichan1})$\3;
\2\12: \0$\\{get}(\\{ichan2})$\3;
\2\13: \0$\\{get}(\\{ichan3})$\3;
\2\14: \0$\\{get}(\\{ichan4})$\3;
\2\15: \0$\\{get}(\\{ichan5})$\3;
\2\16: \0$\\{get}(\\{ichan6})$\3
\2\&{end}\3
\2\&{end};
\3\2\1\1\&{function} $\\{ChanPtr}(\\{id}\mathrel:\\{integer})\mathrel:\\{asciiCode}
$;\40\ $\{\;$Similar to the standard dereferrencing operation. Characters
are converted into numbers in the range $[0..127]$.$\;\}$
\3\2\&{begin} \0\1\&{case} $\\{id}$ \&{of}
\2\11: \0$\\{ChanPtr}\mathrel:=\\{ord}(\\{ichan1}{\up})$\3;
\2\12: \0$\\{ChanPtr}\mathrel:=\\{ord}(\\{ichan2}{\up})$\3;
\2\13: \0$\\{ChanPtr}\mathrel:=\\{ord}(\\{ichan3}{\up})$\3;
\2\14: \0$\\{ChanPtr}\mathrel:=\\{ord}(\\{ichan4}{\up})$\3;
\2\15: \0$\\{ChanPtr}\mathrel:=\\{ord}(\\{ichan5}{\up})$\3;
\2\16: \0$\\{ChanPtr}\mathrel:=\\{ord}(\\{ichan6}{\up})$\3
\2\&{end}\3
\2\&{end};


\secbegin \6Globals in the outer block{ \:m15\7} \.{+=}\par
\pascal
\2$\\{ochan0}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ochan1}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ochan2}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ochan3}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ochan4}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ochan5}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ochan6}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ochan7}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ochan8}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;
\2$\\{ochan9}\mathrel:\mathop{\&{packed }\!}\mathop{\&{file}\!}\mathop{\&{\ of }\!}
\\{ascii}$;\40\ $\{\;$send streams$\;\}$


\secbegin We do not like that \TEX\ dies if the \\{send} file had been opened by other
process. Unfortunately, PDP-10 PASCAL does not provide any clean way to check for
that eventuality, and the program will stop if the file cannot be rewritten
\pascal
\1\3\2\1\1\&{procedure} $\\{RwriteFile}(\\{id}\mathrel:\\{integer};\42\,\\{fname}\mathrel:
\\{char9}
;\42\,
\\{fdirectory}
\mathrel:
\\{integer}
;\42\,
\\{fdevice}
\mathrel:
\\{char6}
)
$;
\3\2\&{begin} \0\1\&{case} $\\{id}$ \&{of}
\2\10: \0$\\{rewrite}(\\{ochan0},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\11: \0$\\{rewrite}(\\{ochan1},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\12: \0$\\{rewrite}(\\{ochan2},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\13: \0$\\{rewrite}(\\{ochan3},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\14: \0$\\{rewrite}(\\{ochan4},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\15: \0$\\{rewrite}(\\{ochan5},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\16: \0$\\{rewrite}(\\{ochan6},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\17: \0$\\{rewrite}(\\{ochan7},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\18: \0$\\{rewrite}(\\{ochan8},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\19: \0$\\{rewrite}(\\{ochan9},\45\\{fname},\450,\45\\{fdirectory},\45
\\{fdevice}
)
$\3;
\2\&{end}\3;
\2\&{end};


\secbegin To know whether a ``send'' stream has already been started, simply check
\\{SendStarted}. It is true only if the stream has been started and not closed.
\pascal
\1\3\2\1\1\&{function} $\\{SendStarted}(\\{stream}\mathrel:\\{integer})\mathrel:
\\{boolean}$;
\3\2\&{begin} \0\1\&{case} $\\{stream}$ \&{of}
\2\10: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan0})$\3;
\2\11: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan1})$\3;
\2\12: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan2})$\3;
\2\13: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan3})$\3;
\2\14: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan4})$\3;
\2\15: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan5})$\3;
\2\16: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan6})$\3;
\2\17: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan7})$\3;
\2\18: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan8})$\3;
\2\19: \0$\\{SendStarted}\mathrel:=\\{eof}(\\{ochan9})$\3
\2\&{end}\3;
\2\&{end};


\secbegin After creating or rewriting a file, its new contents is saved by \\{Close}.
\pascal
\1\3\2\1\1\&{procedure} $\\{Close}(\\{stream}\mathrel:\\{integer})$;
\3\2\&{begin} \0\1\&{case} $\\{stream}$ \&{of}
\2\10: \0$\\{reset}(\\{ochan0})$\3;
\2\11: \0$\\{reset}(\\{ochan1})$\3;
\2\12: \0$\\{reset}(\\{ochan2})$\3;
\2\13: \0$\\{reset}(\\{ochan3})$\3;
\2\14: \0$\\{reset}(\\{ochan4})$\3;
\2\15: \0$\\{reset}(\\{ochan5})$\3;
\2\16: \0$\\{reset}(\\{ochan6})$\3;
\2\17: \0$\\{reset}(\\{ochan7})$\3;
\2\18: \0$\\{reset}(\\{ochan8})$\3;
\2\19: \0$\\{reset}(\\{ochan9})$\3
\2\&{end}\3
\2\&{end};


\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{buffir}=\mathop{\&{array }}[1\mathrel{\!.\,.\!}\\{bufsize}]
\mathop{\&{\ of }\!}
\\{asciiCode}$;


\secbegin The procedure \\{InChTer} reads a character from the terminal (must
be followed by \.{<cr>} because of PASCAL restrictions) and returns it.
Correspondingly, {InLnTer} reads a line from the terminal and places
 the characters (without the final \\{line feed}) in \\{buffer}
\pascal
\1\3\2\1\1\&{function} $\\{InChTer}\mathrel:\\{asciiCode}$;
\3\2\&{begin} \0$\\{break}(\\{terOut})$;
\0$\\{reset}(\\{terIn},\45\\{terfilnam},\450,\450,\45\\{terDevice}
)
$;
\0$\\{InChTer}\mathrel:=\\{ord}(\\{terIn}{\up})$;
\2\1\&{while} $\\{terIn}{\up}<>\\{chr}(\\{carriagereturn})$ \&{do}
\0$\\{get}(\\{terIn})\null$\40\ $\{\;$skip upto <cr>$\;\}$
$\null
$\3
\2\&{end};
\3\2\1\&{define} \\{lineEnd} $=$ $0$
\3\2\1\1\&{procedure} $\\{InLnTer}(\mathop{\&{var}}\\{buffer}\mathrel:\\{buffir};\42\,
\mathop{\&{var}}
\\{bufPtr}
\mathrel:
\\{integer}
;\42\,
\mathop{\&{var}}
\\{brchar}
\mathrel:
\\{asciiCode}
)
$;
\3\2\1\&{label} \0\\{lineEnd};
\3\2\1\&{var} $\\{c}\mathrel:\\{asciiCode}$;
\3\2\&{begin} \40\ $\{\;$\\{bufsize} should be bigger than the actual size of the terminal
	buffer. The input line should never be broken.$\;\}$
\2$\\{break}(\\{terOut})$;
\0$\\{reset}(\\{terIn},\45\\{terfilnam},\450,\450,\45\\{terDevice}
)
$;\40\
$\{\;$open the terminal for input$\;\}$
\2$\\{bufPtr}\mathrel:=1$;\40\
$\{\;$store in first position first$\;\}$
\2\1\&{repeat} \0$\\{c}\mathrel:=\\{ord}(\\{terIn}{\up})$;
\0$\\{buffer}[\\{bufPtr}]\mathrel:=\\{c}$;
\2\1\&{if} $\\{c}=\\{carriagereturn}$ \&{then}
\2\&{begin} \0$\\{brchar}\mathrel:=\\{c}$;
\0$\mathop{\&{goto }\!}\\{lineEnd}$;
\2\&{end}\3
;
\2$\\{get}(\\{terIn})$;
\0$\\{Increment}(\\{bufPtr})$;
\3\2\&{until} $\\{bufPtr}=\\{bufsize}$;
\2$\\{buffer}[\\{bufsize}]\mathrel:=0$;
\0$\\{brchar}\mathrel:=0$;
\2\\{lineEnd}: 
\2\&{end};


\secbegin For prompts, \\{OutChTer} prints an \&{ascii} character at the terminal
\pascal
\1\3\2\1\1\&{procedure} $\\{OutChTer}(\\{c}\mathrel:\\{asciiCode})$;
\3\2\&{begin} \0$\\{terOut}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{terOut})$
\2\&{end};


\secbegin Terminal user input is also reflected in the errors file
\pascal
\1\3\2\1\1\&{procedure} $\\{OutLnErr}$;\40\ $\{\;$inserts a line mark in the errors file$\;\}$
\3\2\&{begin} \0$\\{errfil}{\up}\mathrel:=\\{chr}(\\{carriagereturn})
$;
\0$\\{put}(\\{errfil})$;
\0$\\{errfil}{\up}\mathrel:=\\{chr}(\\{linefeed})$;
\0$\\{put}(\\{errfil})$
\2\&{end};
\3\2\1\1\&{procedure} $\\{OutChErr}(\\{c}\mathrel:\\{asciiCode})$;\40\ $\{\;$prints an \&{ascii} character in the errors file$\;\}$
\3\2\&{begin} \0$\\{errfil}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{errfil})$
\2\&{end};


\secbegin ``Send'' procedures output to the ``send'' streams.
\pascal
\1\3\2\1\1\&{procedure} $\\{SendCh}(\\{stream}\mathrel:\\{integer};\42\,\\{c}\mathrel:
\\{asciiCode}
)
$;
\3\2\&{begin} \0\1\&{case} $\\{stream}$ \&{of}
\2\10: \1\&{begin} \0$\\{ochan0}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan0})$
\2\&{end}\3\3;
\2\11: \1\&{begin} \0$\\{ochan1}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan1})$
\2\&{end}\3\3;
\2\12: \1\&{begin} \0$\\{ochan2}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan2})$
\2\&{end}\3\3;
\2\13: \1\&{begin} \0$\\{ochan3}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan3})$
\2\&{end}\3\3;
\2\14: \1\&{begin} \0$\\{ochan4}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan4})$
\2\&{end}\3\3;
\2\15: \1\&{begin} \0$\\{ochan5}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan5})$
\2\&{end}\3\3;
\2\16: \1\&{begin} \0$\\{ochan6}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan6})$
\2\&{end}\3\3;
\2\17: \1\&{begin} \0$\\{ochan7}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan7})$
\2\&{end}\3\3;
\2\18: \1\&{begin} \0$\\{ochan8}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan8})$
\2\&{end}\3\3;
\2\19: \1\&{begin} \0$\\{ochan9}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{ochan9})$
\2\&{end}\3\3
\2\&{end}\3;
\2\&{end};
\3\2\1\1\&{procedure} $\\{SendLn}(\\{stream}\mathrel:\\{integer})$;\40\ $\{\;$inserts a line mark in the stream$\;\}$
\3\2\&{begin} \0$\\{SendCh}(\\{stream},\45\\{carriagereturn})$;
\0$\\{SendCh}(\\{stream},\45\\{linefeed})$;
\2\&{end};


\secbegin The procedure \\{Print} takes an integer as argument and prints the
corresponding \\{strngpool} entry both in the terminal and in the errors file.
\pascal
\1\3\2\1\1\&{procedure} $\\{Print}(\\{mes}\mathrel:\\{integer})$;
\3\2\1\&{var} $\\{i}\mathrel:\\{integer}$;\40\ $\{\;$index in the string$\;\}$
\2$\\{c}\mathrel:\\{asciiCode}$;
\3\2\&{begin} \0$\\{i}\mathrel:=\\{strng}[\\{mes}]$;
\0$\\{c}\mathrel:=\\{strngpool}[\\{i}]$;
\2\1\&{while} $\\{c}<>\\{null}$ \&{do}
\2\&{begin} \0$\\{terOut}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{errfil}{\up}\mathrel:=\\{chr}(\\{c})$;
\0$\\{put}(\\{terOut})$;
\0$\\{put}(\\{errfil})$;
\0$\\{Increment}(\\{i})$;
\0$\\{c}\mathrel:=\\{strngpool}[\\{i}]$
\2\&{end}\3
;
\2\&{end};
\3\2\1\1\&{procedure} $\\{PrintLn}(\\{mes}\mathrel:\\{integer})$;\40\ $\{\;$Like \\{Print}, but beginning at a new line.$\;\}$
\3\2\&{begin} \0$\\{terOut}{\up}\mathrel:=\\{chr}(\\{carriagereturn})
$;
\0$\\{errfil}{\up}\mathrel:=\\{terOut}{\up}$;
\0$\\{put}(\\{terOut})$;
\0$\\{put}(\\{errfil})$;
\0$\\{terOut}{\up}\mathrel:=\\{chr}(\\{linefeed})$;
\0$\\{errfil}{\up}\mathrel:=\\{terOut}{\up}$;
\0$\\{put}(\\{terOut})$;
\0$\\{put}(\\{errfil})$;
\0$\\{Print}(\\{mes})$
\2\&{end};


\secbegin For number output use \\{PrintInt}, \\{PrintOctal} and \\{PrintReal}.
\pascal
\1\3\2\1\1\&{procedure} $\\{PrintInt}(\\{n}\mathrel:\\{integer})$;\40\ $\{\;$prints an integer in base 10$\;\}$
\3\2\1\&{var} $\\{m}\mathrel:\\{integer}$;
\2$\\{k}\mathrel:\\{integer}$;
\2$\\{s}\mathrel:\mathop{\&{array }}[1\mathrel{\!.\,.\!}11]\mathop{\&{\ of }\!}
\\{asciiCode}$;
\3\2\&{begin} \0\1\&{if} $\\{n}=0$ \&{then}
\0$\\{Print}(\\{zero})$\3
\2\&{else} \1\&{begin} \0$\\{k}\mathrel:=12$;
\2\1\&{if} $\\{n}<0$ \&{then}
\2\&{begin} \0$\\{Print}(\.{{\rm``}-{\rm''}})$;
\0$\\{n}\mathrel:=-\\{n}$
\2\&{end}\3
;
\2\1\&{while} $\\{n}<>0$ \&{do}
\2\&{begin} \0$\\{m}\mathrel:=\\{n}\mathbin{\&{mod}}10$;
\0$\\{Decrement}(\\{k})$;
\2\1\&{case} $\\{m}$ \&{of}
\2\10: \0$\\{s}[\\{k}]\mathrel:=\\{zero}$\3;
\2\11: \0$\\{s}[\\{k}]\mathrel:=\\{one}$\3;
\2\12: \0$\\{s}[\\{k}]\mathrel:=\\{two}$\3;
\2\13: \0$\\{s}[\\{k}]\mathrel:=\\{three}$\3;
\2\14: \0$\\{s}[\\{k}]\mathrel:=\\{four}$\3;
\2\15: \0$\\{s}[\\{k}]\mathrel:=\\{five}$\3;
\2\16: \0$\\{s}[\\{k}]\mathrel:=\\{six}$\3;
\2\17: \0$\\{s}[\\{k}]\mathrel:=\\{seven}$\3;
\2\18: \0$\\{s}[\\{k}]\mathrel:=\\{eight}$\3;
\2\19: \0$\\{s}[\\{k}]\mathrel:=\\{nine}$\3
\2\&{end}\3;
\2$\\{n}\mathrel:=\\{n}\mathbin{\&{div}}10$;
\2\&{end}\3
;
\2\1\&{for} $\\{k}\mathrel:=\\{k}\mathrel{\&{to}}11$ \&{do}
\0$\\{Print}(\\{s}[\\{k}])$\3
;
\2\&{end}\3
\2\&{end};
\3\2\1\1\&{procedure} $\\{PrintOctal}(\\{n}\mathrel:\\{integer})$;\40\ $\{\;$prints an integer in base 8, showing all the
					bits in the machine word$\;\}$
\3\2\1\&{var} $\\{i}\mathrel:\\{integer}$;
\2$\\{k}\mathrel:\\{integer}$;
\2$\\{s}\mathrel:\mathop{\&{array }}[0\mathrel{\!.\,.\!}11]\mathop{\&{\ of }\!}
\\{asciiCode}$;
\2$\\{msb}\mathrel:\\{boolean}$;
\3\2\&{begin} \0$\\{msb}\mathrel:=\\{false}$;
\2\1\&{if} $\\{n}<0$ \&{then}
\2\&{begin} \0$\\{n}\mathrel:=\\{n}-400000000000\mathopen{\hbox{B}}
$;
\0$\\{msb}\mathrel:=\\{true}$
\2\&{end}\3
;\40\
$\{\;$this may cause overflow in
							some systems$\;\}$
\2\1\&{for} $\\{k}\mathrel:=11\mathrel{\&{downto}}0$ \&{do}
\2\&{begin} \0$\\{i}\mathrel:=\\{n}\mathbin{\&{mod}}8$;
\2\1\&{if} $(\\{k}=0)\mathbin{\&{and}}\\{msb}$ \&{then}
\0$\\{i}\mathrel:=\\{i}+4$\3
;
\2\1\&{case} $\\{i}$ \&{of}
\2\10: \0$\\{s}[\\{k}]\mathrel:=\\{zero}$\3;
\2\11: \0$\\{s}[\\{k}]\mathrel:=\\{one}$\3;
\2\12: \0$\\{s}[\\{k}]\mathrel:=\\{two}$\3;
\2\13: \0$\\{s}[\\{k}]\mathrel:=\\{three}$\3;
\2\14: \0$\\{s}[\\{k}]\mathrel:=\\{four}$\3;
\2\15: \0$\\{s}[\\{k}]\mathrel:=\\{five}$\3;
\2\16: \0$\\{s}[\\{k}]\mathrel:=\\{six}$\3;
\2\17: \0$\\{s}[\\{k}]\mathrel:=\\{seven}$\3
\2\&{end}\3;
\2$\\{n}\mathrel:=\\{n}\mathbin{\&{div}}8$;
\2\&{end}\3
;
\2$\\{Print}(\.{{\rm``}'{\rm''}})$;
\0$\\{k}\mathrel:=0$;
\2\1\&{while} $(\\{k}<11)\mathbin{\&{and}}(\\{s}[\\{k}]=\\{zero})$ \&{do}
\0$\\{Increment}(\\{k})$\3
;
\2\1\&{for} $\\{k}\mathrel:=\\{k}\mathrel{\&{to}}11$ \&{do}
\0$\\{Print}(\\{s}[\\{k}])$\3
\2\&{end};
\3\2\1\1\&{procedure} $\\{PrintReal}(\\{x}\mathrel:\\{real})$;\40\ $\{\;$prints a real number with four decimals$\;\}$
\3\2\1\&{var} $\\{n}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{if} $\\{x}<0$ \&{then}
\2\&{begin} \0$\\{Print}(\.{{\rm``}-{\rm''}})$;
\0$\\{x}\mathrel:=-\\{x}$
\2\&{end}\3
;\40\
$\{\;$print sign and make \\x positive$\;\}$
\2\1\&{if} $\\{x}>1000000001$ \&{then}
\0$\\{Print}(\.{{\rm``}(>10\char'1369){\rm''}})\null$\40\ $\{\;$take care of overflows$\;\}$
$\null
$\3
\2\&{else} \0\1\&{if} $\\{x}<0.0001$ \&{then}
\0$\\{Print}(\.{{\rm``}\ .0000{\rm''}})\null$\40\ $\{\;$and underflows in the ``trunc'' and ``round'' routines$\;\}$
$\null
$\3
\2\&{else} \1\&{begin} \0$\\{n}\mathrel:=\\{trunc}(\\{x}+0.00005)$;
\0$\\{PrintInt}(\\{n})$;
\2\1\&{if} $\\{x}<(\\{n}+0.00005)$ \&{then}
\0$\\{Print}(\.{{\rm``}.0000{\rm''}})$\3
\2\&{else} \1\&{begin} \0$\\{Print}(\.{{\rm``}.{\rm''}})$;
\0$\\{n}\mathrel:=\\{round}((\\{x}-\\{n}){\ast}10000)$;
\0$\\{Print}(\\{zero}+(\\{n}\mathbin{\&{div}}1000))$;
\0$\\{n}\mathrel:=\\{n}\mathbin{\&{mod}}1000$;
\0$\\{Print}(\\{zero}+(\\{n}\mathbin{\&{div}}100))$;
\0$\\{n}\mathrel:=\\{n}\mathbin{\&{mod}}100$;
\0$\\{Print}(\\{zero}+(\\{n}\mathbin{\&{div}}10))$;
\0$\\{n}\mathrel:=\\{n}\mathbin{\&{mod}}10$;
\0$\\{Print}(\\{zero}+\\{n})$;
\2\&{end}\3
\2\&{end}\3
;
\2\&{end};


\secbegin This procedure can be used for control of the terminal
\pascal
\1\3\2\1\1\&{procedure} $\\{ForceBufferOut}$;
\3\2\&{begin} \0$\\{break}(\\{terOut})$;
\2\&{end};
\3\2\1\1\&{procedure} $\\{PrintFileName}(\\{fyl}\mathrel:\\{integer})$;\40\ $\{\;$prints the name of a file given its
					integer identifier$\;\}$
\3\2\1\&{var} $\\{s}\mathrel:\\{asciiString}$;
\2$\\{i}\mathrel:\\{integer}$;\40\ $\{\;$index in \\s$\;\}$
\3\2\&{begin} \0$\\{unpack}(\\{fileName}[\\{fyl}],\45\\{s},\450)$;
\0$\\{i}\mathrel:=0$;
\2\1\&{while} $\\{s}[\\{i}]<>\\{null}$ \&{do}
\2\&{begin} \0$\\{Print}(\\{s}[\\{i}])$;
\0$\\{Increment}(\\{i})$
\2\&{end}\3
;
\2$\\{ForceBufferOut}$;
\2\&{end};


\secbegin The procedure \\{InLn} inputs a line from the file identified
by \\{fyl} and places the ascii codes for the characters
in \\{buffer}, starting at position 1
and finishing at position \\{bufPtr}.
The \\{brchar} will contain the break character, which may be:
\dispentry{\hfill carriage return:}{The line finished there.}
\dispentry{\hfill form feed:}{The page finished there.}
\dispentry{\hfill 0:}{The line was too big for the input buffer and had to be cut.}
\dispentry{\hfill undefined:}{The file finished there. (An end of file was found.)}
\par\noindent
If the end of the file is reached \\{eoff} is set to \\{true}.
\\{InLn} assumes that the first element to be read is already
in \\{ChanPtr}[\\{fyl}].
Notice that both \\{InLnTer} and \\{InLn} copy only the carriage return
but not the line feed in the buffer. If this is modified, the places
where these routines are called must be checked.
\pascal
\1\3\2\1\1\&{procedure} $\\{InLn}(\\{fyl}\mathrel:\\{integer};\42\,\mathop{\&{var}}\\{buffer}
\mathrel:
\\{buffir}
;\42\,
\mathop{\&{var}}
\\{bufPtr}
\mathrel:
\\{integer}
;\42\,
\mathop{\&{var}}
\\{brchar}
\mathrel:
\\{asciiCode}
;\42\,
\mathop{\&{var}}
\\{eoff}
\mathrel:
\\{boolean}
)
$;
\3\2\1\&{label} \0\\{lineEnd};\40\ $\{\;$go here if carriage return or form feed were found
			 or if the line was too long and had to be cut$\;\}$
\3\2\1\&{var} $\\{c}\mathrel:\\{asciiCode}$;
\3\2\&{begin} \0$\\{c}\mathrel:=\\{ChanPtr}(\\{fyl})$;\40\
$\{\;$the first character in the line is already
			in \\{chanPtr}(\\{fyl})$\;\}$
\2$\\{bufPtr}\mathrel:=1$;
\0$\\{eoff}\mathrel:=\\{false}$;\40\
$\{\;$if it is true, it will be set below$\;\}$
\2\1\&{if} $\\{c}=\\{linefeed}$ \&{then}
\2\&{begin} \0$\\{GetChan}(\\{fyl})$;
\0$\\{c}\mathrel:=\\{ChanPtr}(\\{fyl})$
\2\&{end}\3
;\40\
$\{\;$skip linefeeds at beginning of line$\;\}$
\2\1\&{repeat} \0\1\&{while} $\\{c}=\\{null}$ \&{do}
\2\&{begin} \0$\\{GetChan}(\\{fyl})$;
\0$\\{c}\mathrel:=\\{ChanPtr}(\\{fyl})$
\2\&{end}\3
;\40\
$\{\;$skip null characters$\;\}$
\2\1\&{if} $\\{eofChan}(\\{fyl})$ \&{then}
\2\&{begin} \0$\\{eoff}\mathrel:=\\{true}$;
\2\1\&{if} $\\{bufPtr}<>1$ \&{then}\40\
$\{\;$undelimited line$\;\}$
\2\&{begin} \0$\\{buffer}[\\{bufPtr}]\mathrel:=\\{carriagereturn}$;
\0$\\{brchar}\mathrel:=\\{carriagereturn}$
\2\&{end}\3
;
\2$\mathop{\&{goto }\!}\\{lineEnd}$
\2\&{end}\3
;
\2$\\{buffer}[\\{bufPtr}]\mathrel:=\\{c}$;
\0$\\{GetChan}(\\{fyl})$;
\2\1\&{if} $(\\{c}=\\{carriagereturn})\mathbin{\&{or}}(\\{c}=\\{formfeed})
$ \&{then}\40\
$\{\;$carriage return or form feed$\;\}$
\2\&{begin} \0$\\{brchar}\mathrel:=\\{c}$;
\0$\mathop{\&{goto }\!}\\{lineEnd}$
\2\&{end}\3
\2\&{else} \0$\\{Increment}(\\{bufPtr})$
;
\2$\\{c}\mathrel:=\\{ChanPtr}(\\{fyl})$
\3\2\&{until} $\\{bufPtr}=\\{maxlinelength}$;
\2$\\{brchar}\mathrel:=0$;
\2\\{lineEnd}: 
\2\&{end};


\secbegin Files may have different formats in different systems and some processing 
may be necessary before the first line of text is availble. The procedure
\\{GetFirstLine} will take care of that. It will obtain the first line
of valid text in the file identified by \\{fyl}, and will put it in
\\{buffer}. Because \TEX\ has to remember page and line numbers
this procedure will have to update \\{page} when
the desired line is finally found,
but it will have to print \.{ <space> <page number> } everytime it enters
a new page of the file. If the file is ill-formatted \\{GetFirstLine} returns
\&{false}.
\\{GetFirstLine} assumes that the first valid entry of the file is already 
in \\{ChanPtr}[\\{fyl}].
\pascal
\1\3\2\1\1\&{function} $\\{GetFirstLine}(\\{fyl}\mathrel:\\{integer};\42\,\mathop{\&{var}}\\{buffer}
\mathrel:
\\{buffir}
;\42\,
\mathop{\&{var}}
\\{bufPtr}
\mathrel:
\\{integer}
;\42\,
\mathop{\&{var}}
\\{brchar}
\mathrel:
\\{asciiCode}
;\42\,
\mathop{\&{var}}
\\{eoff}
\mathrel:
\\{boolean}
;\42\,
\mathop{\&{var}}
\\{page}
\mathrel:
\\{integer}
)
\mathrel:
\\{boolean}
$;
\3\2\1\&{label} \0\\{done};\40\ $\{\;$go here to exit \\{GetFirstLine}$\;\}$
\3\2\&{begin} \0$\\{GetFirstLine}\mathrel:=\\{true}$;\40\
$\{\;$when called, there is at least one character in the
			file and it is saved in \\{ChanPtr}[\\{fyl}]$\;\}$
\2$\\{InLn}(\\{fyl},\45\\{buffer},\45\\{bufPtr},\45\\{brchar},\45
\\{eoff}
)
$;\40\
$\{\;$input one line from file$\;\}$
\2$\null$\6Check end of file{ \:m43\7}$\null $;
\0$\\{Print}(\.{{\rm``}\ {\rm''}})$;
\0$\\{Print}(\\{one})$;\40\
$\{\;$reading from first page of file now$\;\}$
\2\1\&{if} $\null$\6in TVedit directory page{ \:m41\7}$\null $ \&{then}\40\
$\{\;$a feature of the editor at WAITS$\;\}$
\2$\null$\6Skip TVedit directory page. Return \&{false} if problems{ \:m42\7}$\null 
$\3
\2\&{else} \0$\\{page}\mathrel:=1$
;
\2$\null$\6Ignore empty pages at beginning of file{ \:m44\7}$\null 
$;
\2\\{done}: 
\2\&{end};


\secbegin \6in TVedit directory page{ \:m41\7} \.=\par
\pascal
\2$(\\{buffer}[1]=\.{{\rm``}C{\rm''}})\mathbin{\&{and}}
(\\{buffer}[2]=\.{{\rm``}O{\rm''}})\mathbin{\&{and}}
(\\{buffer}[3]=\.{{\rm``}M{\rm''}})\mathbin{\&{and}}
(\\{buffer}[4]=\.{{\rm``}M{\rm''}})\mathbin{\&{and}}
(\\{buffer}[5]=\.{{\rm``}E{\rm''}})\mathbin{\&{and}}
(\\{buffer}[6]=\.{{\rm``}N{\rm''}})\mathbin{\&{and}}
(\\{buffer}[7]=\.{{\rm``}T{\rm''}})
\mathbin{\&{and}}(\\{buffer}[8]=\.{{\rm``}\ {\rm''}})
\mathbin{\&{and}}(\\{buffer}[9]=\.{{\rm``}\char'26{\rm''}})
$

\note This code is used in section 40.

\secbegin \6Skip TVedit directory page. Return \&{false} if problems{ \:m42\7} \.=\par
\pascal
\1\3\2\&{begin} \0\1\&{while} $(\\{brchar}<>\\{formfeed})\mathbin{\&{and}}\mathop{\&{not }\!}
\\{eoff}$ \&{do}\40\
$\{\;$skip lines until end of page$\;\}$
\2$\\{InLn}(\\{fyl},\45\\{buffer},\45\\{bufPtr},\45\\{brchar},\45
\\{eoff}
)
$\3
;
\2$\null$\6Check end of file{ \:m43\7}$\null $;
\0$\\{InLn}(\\{fyl},\45\\{buffer},\45\\{bufPtr},\45\\{brchar},\45
\\{eoff}
)
$;
\0$\null$\6Check end of file{ \:m43\7}$\null $;
\0$\\{Print}(\.{{\rm``}\ {\rm''}})$;
\0$\\{Print}(\\{two})$;\40\
$\{\;$reading from second page now$\;\}$
\2$\\{page}\mathrel:=2$;
\2\&{end}

\note This code is used in section 40.

\secbegin \6Check end of file{ \:m43\7} \.=\par
\pascal
\2\1\&{if} $\\{eoff}$ \&{then}
\2\&{begin} \40\ $\{\;$found end of file in a non empty directory page$\;\}$
\2$\\{GetFirstLine}\mathrel:=\\{false}$;
\0$\mathop{\&{goto }\!}\\{done}$
\2\&{end}\3


\note This code is used in sections 40, 42,  and 44.

\secbegin \6Ignore empty pages at beginning of file{ \:m44\7} \.=\par
\pascal
\2\1\&{while} $\\{brchar}=\\{formfeed}$ \&{do}
\2\&{begin} \0$\\{InLn}(\\{fyl},\45\\{buffer},\45\\{bufPtr},\45\\{brchar},\45
\\{eoff}
)
$;
\0$\null$\6Check end of file{ \:m43\7}$\null $;
\0$\\{Increment}(\\{page})$;
\0$\\{Print}(\.{{\rm``}\ {\rm''}})$;
\0$\\{PrintInt}(\\{page})$
\2\&{end}\3


\note This code is used in section 40.

\secbegin Use \\{Release} when the file is to be forgotten. It will take 
any appropiate action in the file system and will decrement \\{filPtr}.
In this way entries for input files are made available, but font names
will always be remembered.
\pascal
\1\3\2\1\1\&{procedure} $\\{Release}(\\{fyl}\mathrel:\\{integer})$;
\3\2\&{begin} \0\1\&{case} $\\{fyl}$ \&{of}
\2\11: \0$\\{reset}(\\{ichan1})$\3;
\2\12: \0$\\{reset}(\\{ichan2})$\3;
\2\13: \0$\\{reset}(\\{ichan3})$\3;
\2\14: \0$\\{reset}(\\{ichan4})$\3;
\2\15: \0$\\{reset}(\\{ichan5})$\3;
\2\16: \0$\\{reset}(\\{ichan6})$\3
\2\&{end}\3;\40\
$\{\;$Close the file$\;\}$
\2$\\{Decrement}(\\{filPtr})\null$\40\ $\{\;$free that entry in \\{fileName}$\;\}$
$\null
$
\2\&{end};


\secbegin The procedure \\{TraceLine} displays the contents of the input buffer
and waits for a character from the terminal. If the user types
\.{<cr>} the contents of the buffer will be taken as is. Any other
character will make the terminal go to a new line. The user can then
type a line that will overwrite the input buffer (the break character
will still be the old one.)
\pascal
\1\3\2\1\1\&{procedure} $\\{TraceLine}(\mathop{\&{var}}\\{buffer}\mathrel:\\{buffir};\42\,
\mathop{\&{var}}
\\{bufPtr}
\mathrel:
\\{integer}
)
$;
\3\2\1\&{var} $\\{first},\45\\{last}\mathrel:\\{integer}$;\40\ $\{\;$delimit the printable string$\;\}$
\2$\\{brchar},\45\\{oldbrchar}\mathrel:\\{asciiCode}$;\40\ $\{\;$ascii code for break characters$\;\}$
\2$\\{j}\mathrel:\\{integer}$;\40\ $\{\;$index in printable string$\;\}$
\3\2\&{begin} \0$\null$\6Display obtained line on screen{ \:m47\7}$\null 
$;
\0$\null$\6Get a line from the terminal. Preserve old break character{ \:m48\7}$\null 
$;
\0$\null$\6Copy resulting line into errors file{ \:m49\7}$\null 
$;
\2\&{end};


\secbegin \6Display obtained line on screen{ \:m47\7} \.=\par
\pascal
\2$\\{terOut}{\up}\mathrel:=\\{chr}(\\{carriagereturn})
$;
\2$\\{errfil}{\up}\mathrel:=\\{terOut}{\up}$;
\2$\\{put}(\\{terOut})$;
\2$\\{put}(\\{errfil})$;
\2$\\{terOut}{\up}\mathrel:=\\{chr}(\\{linefeed})$;
\2$\\{errfil}{\up}\mathrel:=\\{terOut}{\up}$;
\2$\\{put}(\\{terOut})$;
\2$\\{put}(\\{errfil})$;\40\ $\{\;$prints <cr><lf>$\;\}$
\2\1\&{if} $\\{buffer}[1]=\\{linefeed}$ \&{then}
\0$\\{first}\mathrel:=2$\3
\2\&{else} \0$\\{first}\mathrel:=1$
;\40\ $\{\;$skip \.{<lf>} at beginning of line$\;\}$
\2\1\&{if} $\\{buffer}[\\{bufPtr}]=0$ \&{then}
\0$\\{last}\mathrel:=\\{bufPtr}$\3
\2\&{else} \0$\\{last}\mathrel:=\\{bufPtr}-1$
;\40\ $\{\;$do not print \.{<cr>} or \.{<ff>} at the end$\;\}$
\2\1\&{if} $\\{last}<=\\{first}$ \&{then}
\0$\\{OutChTer}(\.{{\rm``}\ {\rm''}})$\3
;\40\ $\{\;$precede single character and empty line with a space$\;\}$
\2\1\&{for} $\\{j}\mathrel:=\\{first}\mathrel{\&{to}}\\{last}$ \&{do}
\0$\\{OutChTer}(\\{buffer}[\\{j}])$\3


\note This code is used in section 46.

\secbegin \6Get a line from the terminal. Preserve old break character{ \:m48\7} \.=\par
\pascal
\2\1\&{if} $\\{InChTer}<>\\{carriagereturn}$ \&{then}\40\
$\{\;$not carriage return$\;\}$
\2\&{begin} \0$\\{oldbrchar}\mathrel:=\\{buffer}[\\{bufPtr}]$;\40\
$\{\;$save break character$\;\}$
\2\1\&{repeat} \0$\\{get}(\\{terIn})$
\3\2\&{until} $\\{ord}(\\{terIn}{\up})=\\{linefeed}$;\40\
$\{\;$up tp line feed$\;\}$
\2$\{\;$skip rest of command line$\;\}$
\2$\\{InLnTer}(\\{buffer},\45\\{bufPtr},\45\\{brchar})
$;\40\
$\{\;$put a line in the \\{buffer}$\;\}$
\2$\\{buffer}[\\{bufPtr}]\mathrel:=\\{oldbrchar}$;\40\
$\{\;$return it to the buffer$\;\}$
\2$\\{first}\mathrel:=1$;
\0$\\{last}\mathrel:=\\{bufPtr}$;
\2\&{end}\3


\note This code is used in section 46.

\secbegin \6Copy resulting line into errors file{ \:m49\7} \.=\par
\pascal
\2\1\&{for} $\\{j}\mathrel:=\\{first}\mathrel{\&{to}}\\{last}$ \&{do}
\0$\\{OutChErr}(\\{buffer}[\\{j}])$\3


\note This code is used in section 46.

\secbegin The procedure \\{DeclareOFil} is called when the name of the output file is
first known. This procedure opens file \\{outfil} for writing on a certain
external file. The name of that external file name is the default (system
dependent) if no input file was ever mentioned, that is, if all user input
was given on the terminal. Otherwise, it is a name related in some form with
the name of the first mentioned input file.
\pascal
\1\3\2\1\1\&{procedure} $\\{DeclareOFil}(\\{fyl}\mathrel:\\{integer})$;\40\ $\{\;$initializes the output on file \\f$\;\}$
\3\2\1\&{label} \0\6Loop exits{ \:m10\7};
\3\2\1\&{var} $\\{outfylnam}\mathrel:\\{char9}$;\40\ $\{\;$name of file formatted for our pascal compiler$\;\}$
\2$\\{outdev}\mathrel:\\{char6}$;\40\ $\{\;$name of device with pascal format$\;\}$
\2$\\{nodev}\mathrel:\\{boolean}$;\40\ $\{\;$does the name include a device?$\;\}$
\2$\\{s}\mathrel:\\{asciiString}$;\40\ $\{\;$unpacked version of a file name$\;\}$
\2$\\{c}\mathrel:\\{asciiCode}$;\40\ $\{\;$one character of the name$\;\}$
\2$\\{i},\45\\{j}\mathrel:\\{integer}$;
\3\2\&{begin} \0$\\{outfylnam}\mathrel:=\\{outfilnam}$;\40\
$\{\;$initialize with default output file$\;\}$
\2$\\{nodev}\mathrel:=\\{true}$;\40\
$\{\;$no device name seen so far$\;\}$
\2\1\&{if} $\\{fyl}<>\\{outputFile}$ \&{then}\40\
$\{\;$get the file name in the right format for the compiler$\;\}$
\2\&{begin} \0$\\{unpack}(\\{fileName}[\\{fyl}],\45\\{s},\450)$;
\0$\\{j}\mathrel:=0$;
\0$\\{i}\mathrel:=1$;
\2\1\&{repeat} \0$\\{c}\mathrel:=\\{s}[\\{j}]$;
\2\1\&{if} $\\{c}=\.{{\rm``}:{\rm''}}$ \&{then}
\2\&{begin} \0\1\&{for} $\\{i}\mathrel:=1\mathrel{\&{to}}\\{i}-1$ \&{do}
\0$\\{outdev}[\\{i}]\mathrel:=\\{outfylnam}[\\{i}]$\3
;
\2$\\{nodev}\mathrel:=\\{false}$;
\0$\\{i}\mathrel:=1$
\2\&{end}\3
\2\&{else} \0\1\&{if} $(\\{c}=\.{{\rm``}.{\rm''}})\mathbin{\&{or}}(\\{c}=\\{null})
$ \&{then}
\0$\mathop{\&{goto }\!}\\{done}$\3
\2\&{else} \0\1\&{if} $\\{i}<=6$ \&{then}
\2\&{begin} \0$\\{UpperCase}(\\{c})$;
\0$\\{outfylnam}[\\{i}]\mathrel:=\\{chr}(\\{c})$;
\0$\\{Increment}(\\{i})$
\2\&{end}\3
;
\2$\\{Increment}(\\{j})$
\3\2\&{until} $\\{j}>=\\{stringsize}$;
\2\\{done}: \0\1\&{for} $\\{i}\mathrel:=\\{i}\mathrel{\&{to}}6$ \&{do}
\0$\\{outfylnam}[\\{i}]\mathrel:=\.{'\ '}$\3
\2\&{end}\3
;\40\
$\{\;$If, within your PASCAL compiler, it is possible to find out whether a file
is accessible for writing and then return control to the program, then in this
place there should be a loop in which file names were checked and, were the \\{rewrite}
unsuccessful, a new file name were requested$\;\}$
\2\1\&{if} $\\{nodev}$ \&{then}
\0$\\{rewrite}(\\{outfil},\45\\{outfylnam})$\3
\2\&{else} \0$\\{rewrite}(\\{outfil},\45\\{outfylnam},\450,\450,\45\\{outdev}
)
\null$\40\ $\{\;$no such check is possible in our system$\;\}$
$\null
$
\2\&{end};


\secbegin \head{Scanning file names}
\par
In the main \TEX\ module, the function \\{ScanFileName} scans the input for
the name of an external file
and tries to open it. Its argument says whether
it is a font file or send stream for which space has been reserved in the data
structures or an input file that has not been allocated yet.
Because file names are very system dependent, the parsing is done in the system
dependent module as follows:
\dispar
\αFirst \\{InitFileName} is called with the same argument that \\{ScanFileName}
	received from its caller. \\{InitFileName} should then take care of any
	initialization needed for the parsing of the file name. Using its
	argument, it can decide whether the parsed name will refer to a font
	information file, to a ``send'' stream or to an ordinary input file.
	The negative of the argument is returned if there are too many open files
	(this can only happen with input files).\par
\dispar
\αThen \\{AppendToName} is called once for each token in the input. Using the
	data structures set up by \\{InitFileName}, \\{AppendToName} decides everytime
	whether the part of the name received so far is syntactically correct
	for such a file name (otherwise it returns ``malformedname'') and if so,
	whether it has already received a complete file name (otherwise it
	returns ``needmore''). In case the whole file name was received, \\{AppendToName}
	tries to open that file. If it succeeds, it will return done, otherwise it
	returns ``failure''. In any case, \\{AppendToName} saves the scanned string
	in a place from where it can be retrieved for use in error messages.\par
In our version of SYSDEP, there are defaults set for certain parts of
certain file names. \\{AppendToName} accepts everything until it finds a token
that could never be part of a file name. If it is a delimiter (space, period,
etc.) it considers that the whole file name was received and tries to
open it. Otherwise it returns ``malformedname''. Upon an unsuccessful
return from \\{AppendToName}, \\{ScanFileName} returns a value that allows
its calling routine to recognize the failure and locate the stored name if it
has to be printed in some error message.

\secbegin \6Globals in the outer block{ \:m15\7} \.{+=}\par
\pascal
\2$\\{filetype}\mathrel:(\\{fontfile},\45\\{sendfile},\45\\{inputfile})
$;
\2$\\{fnstring}\mathrel:\\{asciiString}$;\40\ $\{\;$unpacked version of whole file name$\;\}$
\2$\\{fnl}\mathrel:\\{integer}$;\40\ $\{\;$index for \\{fnstring}$\;\}$
\2$\\{fil}\mathrel:\\{integer}$;\40\ $\{\;$current file identifier (one of $1,2..\\{maxinfil}$)$\;\}$
\2$\\{fname}\mathrel:\\{char9}$;\40\ $\{\;$file name and extension: must be uppercase$\;\}$
\2$\\{fdir}\mathrel:\\{integer}$;\40\ $\{\;$directory identifier$\;\}$
\2$\\{fprgmr}\mathrel:\\{integer}$;\40\ $\{\;$programmer identifier in a directory ``ppn'' at WAITS$\;\}$
\2$\\{fj}\mathrel:\\{integer}$;
\2$\\{fnstate}\mathrel:(\\{namepart},\45\\{extension},\45\\{project},\45\\{programmer}
,\45
\\{skip}
)
$;


\secbegin The function \\{InitFileName} initializes the data structures that 
will be used by \\{AppendToName} to obtain the name of a file and open it.
\par
If the first argument lies in the range $[0..\\{maxfnt}+1]$,
the file is a font, the name should be allocated in the corresponding
place in the first $nfonts+1$ entries of \\{fileName} and default
name conventions for font names apply (Only $[0..\\{maxfnt}]$ are used for
fonts properly, the extra entry is used for comparisons in \\{DefineFont}.)
 If \\{fnum} is in the range 
$[\\{nfonts}+1..\\{nfonts}+10]$, the file contains an output send stream.
A negative \\{fnum} indicates an input file whose name must be allocated in
the top position of \\{fileName}.
\pascal
\1\3\2\1\1\&{function} $\\{InitFileName}(\\{fnum}\mathrel:\\{integer})\mathrel:
\\{integer}$;
\3\2\1\&{label} \0\\{return};
\3\2\&{begin} \0\1\&{if} $\\{fnum}=\\{inputFile}$ \&{then}
\2\&{begin} \0$\\{fil}\mathrel:=\\{filPtr}-(\\{nfonts}+10)$;\40\
$\{\;$first input file is number 1$\;\}$
\2\1\&{if} $\\{fil}>\\{maxinfil}$ \&{then}\40\
$\{\;$must exit \TEX$\;\}$
\2\&{begin} \0$\\{fil}\mathrel:=-\\{failure}$;\40\
$\{\;$to notify \\{ScanFileName}$\;\}$
\2$\mathop{\&{goto }\!}\\{return}$
\2\&{end}\3
;
\2$\\{filetype}\mathrel:=\\{inputfile}$;
\0$\\{fname}\mathrel:=\.{'\ \ \ \ \ \ TEX'}$;\40\
$\{\;$default name and extension for input files$\;\}$
\2\&{end}\3
\2\&{else} \0\1\&{if} $\\{fnum}>\\{nfonts}$ \&{then}\40\
$\{\;$``send'' output file$\;\}$
\2\&{begin} \0$\\{fil}\mathrel:=\\{fnum}-(\\{nfonts}+1)$;\40\
$\{\;$because first send file is number 0$\;\}$
\2$\\{filetype}\mathrel:=\\{sendfile}$;
\0$\\{fname}\mathrel:=\.{'\ \ \ \ \ \ TEX'}$;
\2\&{end}\3
\2\&{else} \40\ $\{\;$file is a font$\;\}$
\2\&{begin} \0$\\{fil}\mathrel:=\\{fnum}$;
\0$\\{filetype}\mathrel:=\\{fontfile}$;
\0$\\{fname}\mathrel:=\.{'\ \ \ \ \ \ TFM'}$;\40\
$\{\;$default name and extension for font files$\;\}$
\2\&{end}
;
\2$\\{fnl}\mathrel:=0$;
\0$\\{fdir}\mathrel:=0$;
\0$\\{fprgmr}\mathrel:=0$;
\0$\\{fnstate}\mathrel:=\\{namepart}$;
\2\1\&{for} $\\{fj}\mathrel:=0\mathrel{\&{to}}\\{stringsize}-1$ \&{do}
\0$\\{fnstring}[\\{fj}]\mathrel:=\\{null}$\3
;
\2$\\{fj}\mathrel:=1$;
\2\\{return}: \0$\\{InitFileName}\mathrel:=\\{fil}$;
\2\&{end};


\secbegin If a file with the given name cannot be opened, \\{AppendToName}
tries the defaults. If there are no defaults or they fail too, then
this routine returns \\{failure}. At this time, the file name should be in
\\{fileName}, accesible for error messages, but the occupied entry should be
reused by subsequent executions of \\{InitFileName} (i.e., there is no need
to release it.) Font name extensions are always assumed to be the default
(it doesn't matter whether it is not explicit or a different one has been specified).
\par
(For example, in the WAITS system $fnum=inputFile$ means that the
default file extension is \.{.TEX}
while \\{fnum} {\bf in} [\.0$\ldots$\\{maxfnt}] means
that the default extension is \.{.TFM}. A non-explicit directory always
defaults to {\bf [TEX,SYS]}.) 
\pascal
\1\3\2\1\1\&{function} $\\{AppendToName}(\\{cmmd},\45\\{ch}\mathrel:\\{integer})
\mathrel:\\{integer}$;
\3\2\1\&{label} \0\\{return};
\3\2\1\&{var} $\\{problems}\mathrel:\\{boolean}$;
\2$\\{jj}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{if} $\\{cmmd}>\\{charcodes}$ \&{then}
\2\&{begin} \0$\\{PrintLn}(\.{{\rm``}Blank\ space\ should\ follow\ file\ name.{\rm''}}
)
$;
\0$\\{AppendToName}\mathrel:=\\{malformedname}$
\2\&{end}\3
\2\&{else} \0\1\&{if} $\\{cmmd}=\\{spacer}$ \&{then}\40\
$\{\;$end of name string$\;\}$
\2$\null$\6Open the file. Try the defaults if cannot open a file
with the given name. Return with either \\{done}
or \\{failure}{ \:m55\7}$\null 
$\3
\2\&{else} \0$\null$\6Process the character as a component of the file name.
Return with \\{needmore}{ \:m56\7}$\null 
$
\2\&{end};


\secbegin \6Open the file. Try the defaults if cannot open a file
with the given name. Return with either \\{done}
or \\{failure}{ \:m55\7} \.=\par
\pascal
\1\3\2\&{begin} \0\1\&{if} $\\{fnstate}=\\{programmer}$ \&{then}\40\
$\{\;$add omitted ``]''$\;\}$
\2\&{begin} \0$\\{fdir}\mathrel:=\\{fdir}+\\{fprgmr}$;
\0$\\{fnstring}[\\{fnl}]\mathrel:=\.{{\rm``}]{\rm''}}$;
\0$\\{Increment}(\\{fnl})$;
\2\&{end}\3
\2\&{else} \0\1\&{if} $(\\{fnstate}=\\{namepart})\mathbin{\&{and}}(\\{filetype}<>\\{fontfile})
$ \&{then}\40\
$\{\;$add default extension$\;\}$
\2\&{begin} \0$\\{fnstring}[\\{fnl}]\mathrel:=\.{{\rm``}.{\rm''}}$;
\0$\\{Increment}(\\{fnl})$;
\0$\\{fnstring}[\\{fnl}]\mathrel:=\.{{\rm``}T{\rm''}}$;
\0$\\{Increment}(\\{fnl})$;
\0$\\{fnstring}[\\{fnl}]\mathrel:=\.{{\rm``}E{\rm''}}$;
\0$\\{Increment}(\\{fnl})$;
\0$\\{fnstring}[\\{fnl}]\mathrel:=\.{{\rm``}X{\rm''}}$;
\0$\\{Increment}(\\{fnl})$;
\0$\\{fj}\mathrel:=\\{fnl}$;\40\
$\{\;$directory part should start here$\;\}$
\2\&{end}\3
;
\2\1\&{case} $\\{filetype}$ \&{of}
\2\1\\{inputfile}: \1\&{begin} \0$\\{RsetFile}(\\{fil},\45\\{fname},\45\\{fdir},\45\.{'DSK\ \ \ '}
)
$;
\2\1\&{if} $\\{eofChan}(\\{fil})$ \&{then}
\2\1\&{if} $\\{fdir}=0$ \&{then}
\2\&{begin} \0$\\{RsetFile}(\\{fil},\45\\{fname},\45\\{libraryarea},\45\.{'DSK\ \ \ '}
)
$;
\2\1\&{if} $\\{eofChan}(\\{fil})$ \&{then}
\0$\\{AppendToName}\mathrel:=\\{failure}\null$\40\ $\{\;$close the file if necessary$\;\}$
$\null
$\3
\2\&{else} \1\&{begin} \0$\\{fnstring}[\\{fj}]\mathrel:=\.{{\rm``}[{\rm''}}$;
\0$\\{Increment}(\\{fj})$;
\0$\\{fnstring}[\\{fj}]\mathrel:=\.{{\rm``}T{\rm''}}$;
\0$\\{Increment}(\\{fj})$;
\0$\\{fnstring}[\\{fj}]\mathrel:=\.{{\rm``}E{\rm''}}$;
\0$\\{Increment}(\\{fj})$;
\0$\\{fnstring}[\\{fj}]\mathrel:=\.{{\rm``}X{\rm''}}$;
\0$\\{Increment}(\\{fj})$;
\0$\\{fnstring}[\\{fj}]\mathrel:=\.{{\rm``},{\rm''}}$;
\0$\\{Increment}(\\{fj})$;
\0$\\{fnstring}[\\{fj}]\mathrel:=\.{{\rm``}S{\rm''}}$;
\0$\\{Increment}(\\{fj})$;
\0$\\{fnstring}[\\{fj}]\mathrel:=\.{{\rm``}Y{\rm''}}$;
\0$\\{Increment}(\\{fj})$;
\0$\\{fnstring}[\\{fj}]\mathrel:=\.{{\rm``}S{\rm''}}$;
\0$\\{Increment}(\\{fj})$;
\0$\\{fnstring}[\\{fj}]\mathrel:=\.{{\rm``}]{\rm''}}$;
\0$\\{Increment}(\\{fj})$;
\0$\\{Increment}(\\{filPtr})$;
\0$\\{AppendToName}\mathrel:=\\{done}$
\2\&{end}\3
\2\&{end}\3
\2\&{else} \0$\\{AppendToName}\mathrel:=\\{failure}$
\3
\2\&{else} \1\&{begin} \0$\\{Increment}(\\{filPtr})$;
\0$\\{AppendToName}\mathrel:=\\{done}$
\2\&{end}\3
;
\2$\\{pack}(\\{fnstring},\450,\45\\{fileName}[\\{nfonts}+10+\\{fil}]
)
$;
\2\&{end}\3\3;
\2\1\\{fontfile}: \1\&{begin} \0\1\&{if} $\\{fdir}=\\{libraryarea}$ \&{then}
\0$\\{fnstring}[\\{fnl}-9]\mathrel:=\\{null}\null$\40\ $\{\;$get rid of directory name$\;\}$
$\null
$\3
\2\&{else} \0\1\&{if} $\\{fdir}=0$ \&{then}
\0$\\{fdir}\mathrel:=\\{libraryarea}$\3
;
\2$\\{pack}(\\{fnstring},\450,\45\\{fileName}[\\{fil}])
$;\40\
$\{\;$font names don't have extension or directory$\;\}$
\2\1\&{if} $\\{fil}=\\{dummyFont}$ \&{then}
\0$\\{AppendToName}\mathrel:=\\{done}\null$\40\ $\{\;$the dummy font file always succeeds$\;\}$
$\null
$\3
\2\&{else} \1\&{begin} \0$\\{reset}(\\{fontfil},\45\\{fname},\450,\45\\{fdir})
$;
\2\1\&{if} $\\{eof}(\\{fontfil})$ \&{then}
\0$\\{AppendToName}\mathrel:=\\{failure}$\3
\2\&{else} \0$\\{AppendToName}\mathrel:=\\{done}$
\2\&{end}\3
\2\&{end}\3\3;
\2\1\\{sendfile}: \1\&{begin} \0\1\&{if} $\\{SendStarted}(\\{fil})$ \&{then}
\0$\\{Close}(\\{fil})$\3
;\40\
$\{\;$Again, as in \\{DeclareOFil}, if it is possible to find out whether a file
is accessible for writing and then return control to the program, then in this
place there should be a loop in which file names were checked and,
were the \\{rewrite} unsuccessful, a new file name were requested$\;\}$
\2$\\{RwriteFile}(\\{fil},\45\\{fname},\45\\{fdir},\45\.{'DSK\ \ \ '}
)
$;
\0$\\{pack}(\\{fnstring},\450,\45\\{fileName}[\\{nfonts}+1+\\{fil}]
)
$;
\0$\\{AppendToName}\mathrel:=\\{done}$;
\2\&{end}\3\3
\2\&{end}\3\40\
$\{\;$case$\;\}$
\2\&{end}

\note This code is used in section 54.

\secbegin \6Process the character as a component of the file name.
Return with \\{needmore}{ \:m56\7} \.=\par
\pascal
\1\3\2\&{begin} \0$\\{UpperCase}(\\{ch})$;\40\
$\{\;$make letters upper case for operating system$\;\}$
\2\1\&{case} $\\{fnstate}$ \&{of}
\2\1\\{namepart}: \0\1\&{if} $\\{ch}=\.{{\rm``}.{\rm''}}$ \&{then}
\2\&{begin} \0\1\&{if} $\\{filetype}<>\\{fontfile}$ \&{then}\40\
$\{\;$extensions in font names are disregarded$\;\}$
\2\&{begin} \0$\\{fj}\mathrel:=7$;
\0$\\{fname}[7]\mathrel:=\.{'\ '}$;
\0$\\{fname}[8]\mathrel:=\.{'\ '}$;
\0$\\{fname}[9]\mathrel:=\.{'\ '}$;
\2\&{end}\3
;
\2$\\{fnstate}\mathrel:=\\{extension}$
\2\&{end}\3
\2\&{else} \0\1\&{if} $\\{ch}=\.{{\rm``}[{\rm''}}$ \&{then}
\2\&{begin} \0\1\&{if} $\\{filetype}<>\\{fontfile}$ \&{then}
\2\&{begin} \0$\\{fnstring}[\\{fnl}]\mathrel:=\.{{\rm``}.{\rm''}}$;
\0$\\{Increment}(\\{fnl})$;
\0$\\{fnstring}[\\{fnl}]\mathrel:=\.{{\rm``}T{\rm''}}$;
\0$\\{Increment}(\\{fnl})$;
\0$\\{fnstring}[\\{fnl}]\mathrel:=\.{{\rm``}E{\rm''}}$;
\0$\\{Increment}(\\{fnl})$;
\0$\\{fnstring}[\\{fnl}]\mathrel:=\.{{\rm``}X{\rm''}}$;
\0$\\{Increment}(\\{fnl})$;
\2\&{end}\3
;
\2$\\{fnstate}\mathrel:=\\{project}$
\2\&{end}\3
\2\&{else} \0\1\&{if} $\\{fj}<=6$ \&{then}
\2\&{begin} \0$\\{fname}[\\{fj}]\mathrel:=\\{chr}(\\{ch})$;
\0$\\{Increment}(\\{fj})$
\2\&{end}\3
\3;
\2\1\\{extension}: \1\&{begin} \0\1\&{if} $\\{filetype}=\\{fontfile}$ \&{then}
\0$\\{Decrement}(\\{fnl})$\3
;\40\
$\{\;$get rid of period$\;\}$
\2\1\&{if} $\\{ch}=\.{{\rm``}[{\rm''}}$ \&{then}
\0$\\{fnstate}\mathrel:=\\{project}$\3
\2\&{else} \0\1\&{if} $\\{filetype}=\\{fontfile}$ \&{then}
\0$\mathop{\&{goto }\!}\\{return}$\3
\2\&{else} \0\1\&{if} $(\\{fj}<=9)$ \&{then}
\2\&{begin} \0$\\{fname}[\\{fj}]\mathrel:=\\{chr}(\\{ch})$;
\0$\\{Increment}(\\{fj})$
\2\&{end}\3
;
\2\&{end}\3\3;
\2\1\\{project}: \0\1\&{if} $\\{ch}=\.{{\rm``},{\rm''}}$ \&{then}
\2\&{begin} \0\1\&{if} $\\{fdir}>=400000\mathopen{\hbox{B}}$ \&{then}
\0$\\{fdir}\mathrel:=(\\{fdir}-400000\mathopen{\hbox{B}})
{\ast}1000000\mathopen{\hbox{B}}+400000000000\mathopen{\hbox{B}}
$\3
\2\&{else} \0$\\{fdir}\mathrel:=\\{fdir}{\ast}1000000\mathopen{\hbox{B}}
$
;
\2$\\{fnstate}\mathrel:=\\{programmer}$
\2\&{end}\3
\2\&{else} \0$\\{fdir}\mathrel:=\\{fdir}{\ast}100\mathopen{\hbox{B}}
+(\\{ch}-40\mathopen{\hbox{B}})$
\3;
\2\1\\{programmer}: \0\1\&{if} $\\{ch}=\.{{\rm``}]{\rm''}}$ \&{then}
\2\&{begin} \0$\\{fdir}\mathrel:=\\{fdir}+\\{fprgmr}$;
\0$\\{fnstate}\mathrel:=\\{skip}$
\2\&{end}\3
\2\&{else} \0$\\{fprgmr}\mathrel:=\\{fprgmr}{\ast}100\mathopen{\hbox{B}}
+(\\{ch}-40\mathopen{\hbox{B}})$
\3;
\2\1\\{skip}: \0$\mathop{\&{goto }\!}\\{return}$\3
\2\&{end}\3;
\2\1\&{if} $\\{fnl}<=\\{stringsize}$ \&{then}
\2\&{begin} \0$\\{LowerCase}(\\{ch})$;
\0$\\{fnstring}[\\{fnl}]\mathrel:=\\{ch}$;
\0$\\{Increment}(\\{fnl})$
\2\&{end}\3
;
\2\\{return}: \0$\\{AppendToName}\mathrel:=\\{needmore}$
\2\&{end}

\note This code is used in section 54.

\secbegin \head{Reading font information}
For its tysetting task, \TEX\ makes use of up to \\{nfonts} different fonts
($\\{nfonts}≤256$).
 Each font used by \TEX\ has an associated font information file --called TFM,
for \TEX\ Font Metrics--
that must be read into the arrays \\{fontinfo}, \\{fmem} (updating also
the pointer \\{fmemptr}), \\{wdbase}, \\{htbase}, \\{dpbase}, \\{icbase},
\\{lgbase}, \\{krbase}, \\{extbase} and \\{parbase}, for internal use by
the \TEX\ program.
In DEC machines, the name of this file is obtained by appending the extension
code ``\.{.TFM}'' to the font file name. For
example, the \TEX\ font metrics for the font \.{CMR10} appear on the
file \.{CMR10.TFM}.
The newest especification of the metric files (November 1980) is due
to Lyle Ramshaw.\par
 The TFM files are written with 32 bits in each
word, to facilitate their transportability.  When they sit in the
file systems of PDP-10's, these 32 data bits will be left-justified
in the PDP-10's 36-bit word, leaving the rightmost four bits zero.\par
The first 6 words of a TFM file contain twelve 16-bit integers
that give the lengths of the various portions of the file, packed two
to a word.  These twelve integers are, in order:
$$\vbox{\halign{\qquad\qquad{#}⊗\hbox{#}\hfill\cr
⊗	\\{lf}=length of entire file in words,\cr
⊗	\\{lh}=length of header data,\cr
⊗	\\{bc}=first character code in font,\cr
⊗	\\{ec}=last character code in font,\cr
⊗	\\{nw}=number of words in width table,\cr
⊗	\\{nh}=number of words in height table,\cr
⊗	\\{nd}=number of words in depth table,\cr
⊗	\\{ni}=number of words in italic correction table,\cr
⊗	\\{nl}=number of words of lig/kern program,\cr
⊗	\\{nk}=number of words in kern table,\cr
⊗	\\{ne}=number of words in extensible character table,\cr
⊗	\\{np}=number of font parameters.\cr}
}$$
\par
In TFM format, the subfields of a word are always allocated in
left-to-right (BigEndian) order.  Thus, the first two integers
in this list, \\{lf} and \\{lh}, are packed into the first word of the
TFM file with \\{lf} on the left and \\{lh} on the right.
These lengths are not all independent:  they must obey the relation that
	$$lf=6+lh+(ec-bc+1)+nw+nh+nd+ni+nk+nl+ne+np.$$
\par
The rest of the TFM file is a sequence of ten data arrays as specified
below:
$$\vbox{\halign{\qquad\qquad{#}⊗\hbox{#}\hfill\cr
⊗	HEADER=  array [0..\\{lh}-1] of stuff\cr
⊗	FINFO= array [\\{bc}..\\{ec}] of FInfoEntry\cr
⊗	WIDTH= array [0..\\{nw}-1] of \\{FIX}\cr
⊗	HEIGHT= array [0..\\{nh}-1] of \\{FIX}\cr
⊗	DEPTH= array [0..\\{nd}-1] of \\{FIX}\cr
⊗	CHARIC= array [0..\\{ni}-1] of \\{FIX}\cr
⊗	LIG/KERN= array [0..\\{nl}-1] of LigKernStep\cr
⊗	KERN= array [0..\\{nk}-1] of \\{FIX}\cr
⊗	EXT= array [0..\\{ne}-1] of ExtRecipe\cr
⊗	PARAMS= array [1..\\{np}] of \\{FIX}.\cr}
}$$
\par
A \\{FIX} is a 32-bit representation of a real number in a fixed-point
fashion.  \\{FIX}'s are used in TFM format to enhance transportability.
A \\{FIX} is a signed quantity, with the two's complement of the entire \\{FIX}
used to represent negation.  Of the 32 bits, 12 are to the
left and 20 are to the right of the binary point.  This means that a
\\{FIX} has 1 bit of sign, 11 bits of integer, and 20 bits of fraction.
Note that this limits the size of real numbers that a \\{FIX} can represent:
the largest \\{FIX} is roughly 2000.
\par
The first data array is a block of header information,
general information about the font.  Currently,  the header contains
18 words, allocated as described below.  In the future, new fields might
be added at the end of the header block.
$$\vbox{\halign{{#}⊗\quad\hbox{#}\hfill\cr
HEADER=⊗\cr
⊗	[\cr
⊗	CheckSum:  1 word\cr
⊗	DesignSize:  \\{FIX}  (1 word)\cr
⊗	CharacterCodingScheme: 10 words\cr
⊗	ParcFontIdentifier: 5 words\cr
\noalign{\vskip 2pt}
⊗\vbox{\hbox{\hbox{\ Random word (Header[17] is broken up as follows:)}\hfill}
	\halign{{#}⊗\qquad\quad\hbox{#}\hfill\cr
	⊗	[\cr
	⊗	SevenBitSafe:  1 bit\cr
	⊗	unusedspace:   23 bits\cr
	⊗	ParcFaceByte: 8 bits\cr
	⊗	]\cr}}\cr
⊗	]\cr}
}$$
\par
The CheckSum field is used to hold a unique identifier of some sort that
describes this version of the font.  This unique ID is put by Metafont into
both the rasters and metrics.  \TEX\ finds it in the metrics, and stores it in
the DVI file.  Thus, a spooler can check the unique ID in the DVI with
the unique ID in its rasters, to provide a guarantee that \TEX\ was working
with metric data for the current rasters.  Metafont computes this checksum
from the metric information in the TFM file. 
\par
The DesignSize of the font is the size that the font was intended to look
good at, or, to put it another way, the nominal size of the font when
it is printed at a magnification of $1.0$.  For unusual fonts such as \.{CMDUNH}
and \.{CMATHX}, the DesignSize is more-or-less arbitrary.  The 
DesignSize is stored as a \\{FIX} with the units ``points''.
\par
The CharacterCodingScheme field is supposed to specify what the character
code to symbol translation scheme is in this font.  The coding scheme is 
stored in 10 words=40 bytes of the TFM file, as a string.  The first byte
gives the length of the string, the next  n  bytes are the characters, and the
last (39-n) bytes are zeros  (where ``first'' and ``next'' imply working from
left--to--right).  Some common coding scheme names
are:
$$\vbox{\halign{\qquad\qquad{#}⊗\hbox{#}\hfill\cr
⊗\qquad\ CharacterCodingSchemes:\cr
⊗	UNSPECIFIED  ---default, means no information\cr
⊗	GRAPHIC  ---special purpose code, non-alphabetic\cr
⊗	ALPHABETIC   ---means alphabet agrees with ascii at least\cr
⊗	ASCII   ---means exactly ascii\cr
⊗	TEX TEXT\cr
⊗	TEX TYPEWRITER TEXT\cr
⊗	TEX MATHIT\cr
⊗	TEX MATHSY\cr
⊗	TEX MATHEX\cr
⊗	PARC TEXT  ---TimesRoman and Helvetica, for example\cr
⊗	SUAI\cr
⊗	CMU\cr
⊗	MIT\cr}
}$$
\par
At Stanford, fonts are universally referred to by their file names:  for
example ``CMR10'' for Computer Modern Roman 10 point, ``CMTT'' for Computer
Modern TypeWriter Type 10 point, etc.  The \TEX\ user specifies the font
by giving this string name, the \TEX\ output module finds the metric file
by using this name with the extension TFM, and
the various printers store the rasters as files with this name and some
other extension.  At Parc, however, fonts are not stored in separate files
but rather in mammoth things called dictionaries.  And a font is referred
to not by a file name, but rather by a ``family name'' (a string of no
more than 19 characters), a ``face'' (a byte), and a ``size'' (sixteen bit
integer in units of micas).  The remaining fields of the HEADER portion
of the file specify the ``family name'' and ``face'' byte that should be
used to refer to this font at PARC or in Press files.  The family
name is stored in 5 words=20 bytes.  the first byte gives the length n of the
string, the next n bytes are the characters, and the last (19-n) bytes
are zero.    The PARC face byte is stored in the right-most byte of
the Random word.\par
The TFM format and the internal works of the \TEX-PASCAL program
always allow a full eight bits for a character code.  However,
we have made \\{charsperfont}=128 for reasons of memory economy: it is a waste
to reserve 256 entries per font if about all fonts that will be ever used
contain 128 characters.\par
Even so, we want \TEX\ to be able to read and use TFM
files that describe eight bit fonts, simply by throwing away the
information specifically about eight bit character codes.  In order
to make this work safely, however, the TFM's must have the property that
no eight-bit codes can arise out of seven bit codes in the normal running 
of \TEX.  In particular, the following three properties must hold:
\dispentry{\hfill i)\quad}{No seven bit character ligs with a seven bit character to
produce an eight bit character.}
\dispentry{\hfill ii)\quad}{All of the pieces of an extensible seven bit character
must be seven bit characters.}
\dispentry{\hfill iii)\quad}{No charlist can lead from a seven bit character up to
an eight bit character.}
\par
If a TFM file is guaranteed to have these properties, then it is
legal to set the SevenBitSafe bit, which is the sign bit of the
Random HEADER word.  When \\{charsperfont}<256, \TEX\ will scream if
it reads a TFM file that describes eight bit characters, but for
which the SevenBitSafe bit is zero.
\par
The HEADER data is followed by the FINFO table, which is an array
of FInfoEntries.  This array is indexed from \\{bc} to \\{ec}, and hence contains
$ec-bc+1$ entries.  Each FInfoEntry is one word in length.
The FINFO portion of the TFM file is read into \TEX's array
$\\{fontinfo}[\\f,0..\\{charsperfont}-1]$.
We use the range $[0..\\{charsperfont}-1]$ instead of $[\\{bc}..\\{ec}]$
because having the same range for all fonts helps in locating
particular entries (only the character code is needed).
\par
The fields in the FInfoEntry do not give the character width, height,
etc. directly, they are indices into secondary tables. Thus, up to 256
different widths may appear among the 256 possible characters of a single font,
and up to 16 different heights, 16 different depths, and 64 different
italic corrections.  The actual widths, heights, depts and italic 
corrections are stored in the TFM file as arrays of \\{FIX}'s  with 
``ems'' as their units. The \\{ReadFontInfo} procedure reads in these
\\{FIX}'s, converts them to 
floating point form, scales them by multiplying by the desired
font size (in points), and stores them into the internal character metric
arrays. This is true for all entries except those in the LIG/KERN array
(wich contain a program, that will be stored in positions \\{lgbase} and following
of \\{fmem}) and the first entry of the PARAMS
array, which contains the ``slant'':
since slant is a pure number, it should not be scaled.
\par\noindent
A note on non-existent characters:  all character codes outside of the
range [\\{bc},\\{ec}] represent characters that do not exist in the font.  Any
codes in the range [\\{bc},\\{ec}] that represent non-existent characters will
have their FInfoEntries identically equal to 0.  The WIDTH,
HEIGHT, DEPTH, and CHARIC arrays will each be guaranteed to
have a \\{FIX} of $0.0$ in their $0↑{th}$ position.  Thus, failing to notice that
a character is non-existent won't lead a program to use irrelevant
metric data for that character code.  Furthermore,
any characters that really do exist in the font will be guaranteed to
have a WidthIndex that is nonzero.  Thus, a character is non-existent
iff its WidthIndex is zero, and also iff its entire FInfoEntry is zero.
If there are any actual characters in the font whose width just
happens to be precisely zero, the WIDTH
array will contain two zero \\{FIX}'s:  one at index 0, which is used
for all of the non-existent characters, and one somewhere else.

\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{fntinfoarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{maxfnt},\450\mathrel{\!.\,.\!}
\\{charsperfont}
-
1
]
\mathop{\&{\ of }\!}
\\{bytes4}
$;\40\ $\{\;$primary font information table as \TEX\ wants it$\;\}$
\2$\\{fmemarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{fmemsize}-1]
\mathop{\&{\ of }\!}
\\{memoryword}
$;\40\ $\{\;$font memory for secondary font info as \TEX\ wants it$\;\}$
\2$\\{fbasearray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{maxfnt}]\mathop{\&{\ of }\!}
\\{integer}$;\40\ $\{\;$type of base arrays$\;\}$
\2$\\{fpfiarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{maxfnt},\451\mathrel{\!.\,.\!}
5
]
\mathop{\&{\ of }\!}
\\{bytes4}
$;
\3\2\1\&{define} \\{fmemoverflow} $=$ $1$
\3\2\1\&{define} \\{dangerousfont} $=$ $2$

\secbegin \\{ReadFontInfo} takes the font information from a file 
and puts it in the internal character metric arrays employed by \TEX. 
The contents of these arrays is described in \.{TEX.DOC}.
Notice that, sometimes, \\{fontinfo} is set to integer 0, and that
$\\{fontfil}\up\\{.fourbytes}$ is assigned directly to \\{fontinfo} entries.
This works correctly for the PDP-10 pascal compiler where fields are packed
left-to-right in each word (thus unused bits are always on the right).
\pascal
\1\3\2\1\1\&{function} $\\{ReadFontInfo}(\\{fyl}\mathrel:\\{integer};\42\,\mathop{\&{var}}\\{fontinfo}
\mathrel:
\\{fntinfoarray}
;\42\,
\mathop{\&{var}}
\\{fmem}
\mathrel:
\\{fmemarray}
;\42\,
\mathop{\&{var}}
\\{wdbase}
,\45
\\{htbase}
,\45
\\{dpbase}
,\45
\\{icbase}
,\45
\\{lgbase}
,\45
\\{krbase}
,\45
\\{extbase}
,\45
\\{parbase}
\mathrel:
\\{fbasearray}
;\42\,
\mathop{\&{var}}
\\{fcksum}
,\45
\\{fpfb}
,\45
\\{fmag}
\mathrel:
\\{fbasearray}
;\42\,
\mathop{\&{var}}
\\{fpfi}
\mathrel:
\\{fpfiarray}
;\42\,
\mathop{\&{var}}
\\{fmemptr}
\mathrel:
\\{integer}
;\42\,
\\{psize}
\mathrel:
\\{real}
;\42\,
\\{atclause}
\mathrel:
\\{boolean}
)
\mathrel:
\\{integer}
$;
\3\2\1\&{var} $\\{fl},\45\\{lh},\45\\{ec},\45\\{bc},\45\\{nw},\45\\{nh}
,\45\\{nd},\45\\{ni},\45\\{nl},\45\\{nk},\45
\\{ne},\45\\{np}\mathrel:\\{integer}$;\40\ $\{\;$halves of first 6 words of file$\;\}$
\2$\\{fbt}\mathrel:\\{memoryword}$;\40\ $\{\;$the random word of the HEADER (very system dependent usage)$\;\}$
\2$\\{i},\45\\{m},\45\\{p}\mathrel:\\{integer}$;
\2$\\{dsize},\45\\{metricscale}\mathrel:\\{real}$;\40\ $\{\;$design size and size in which the font will be used$\;\}$
\2$\\{fc},\45\\{lc}\mathrel:\\{integer}$;\40\ $\{\;$the first and last codes that \TEX\ wants$\;\}$
\2$\\{fbc},\45\\{lec}\mathrel:\\{integer}$;\40\ $\{\;$endpoints of intersection of the range of existing
		codes and the range of codes that \TEX\ wants$\;\}$
\3\2\&{begin} \0$\null$\6Read first six words of file. Set \\m to size of memory
required{ \:m60\7}$\null 
$;
\2\1\&{if} $(\\{fmemptr}+\\{m}>=\\{fmemsize})$ \&{then}
\0$\\{ReadFontInfo}\mathrel:=\\{fmemoverflow}\null$\40\ $\{\;$no space left to
				store the font information: must quit \TEX$\;\}$
$\null
$\3
\2\&{else} \1\&{begin} \0$\null$\6Read HEADER. Set \\{metricscale} and \\{fbt} and also
corresponding entries in \\{fcksum}, \\{fmag},
\\{fpfi} and \\{fpfb}{ \:m61\7}$\null 
$;
\0$\null$\6Set \\{fontinfo} using the FINFO part of the file{ \:m62\7}$\null 
$;
\0$\\{p}\mathrel:=\\{fmemptr}$;
\0$\null$\6Load remaining tables{ \:m63\7}$\null $;\40\
$\{\;$into \\{fmem}$\;\}$
\2$\\{fmemptr}\mathrel:=\\{fmemptr}+\\{m}$;
\0$\null$\6Set entries in base arrays{ \:m64\7}$\null 
$;
\2\1\&{if} $((\\{charsperfont}<256)\mathbin{\&{and}}(\\{ec}>\\{lc})
\mathbin{\&{and}}
(\\{fbt}.\\{int}>=0)
)
$ \&{then}
\0$\\{ReadFontInfo}\mathrel:=\\{dangerousfont}$\3
\2\&{else} \0$\\{ReadFontInfo}\mathrel:=\\{done}$
;
\2\&{end}\3
;
\2\&{end};


\secbegin \6Read first six words of file. Set \\m to size of memory
required{ \:m60\7} \.=\par
\pascal
\2$\\{fl}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{lhword}
$;
\2$\\{lh}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{rhword}
$;
\2$\\{get}(\\{fontfil})$;
\2$\\{bc}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{lhword}
$;
\2$\\{ec}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{rhword}
$;
\2$\\{get}(\\{fontfil})$;
\2$\\{nw}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{lhword}
$;
\2$\\{nh}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{rhword}
$;
\2$\\{get}(\\{fontfil})$;
\2$\\{nd}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{lhword}
$;
\2$\\{ni}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{rhword}
$;
\2$\\{get}(\\{fontfil})$;
\2$\\{nl}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{lhword}
$;
\2$\\{nk}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{rhword}
$;
\2$\\{get}(\\{fontfil})$;
\2$\\{ne}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{lhword}
$;
\2$\\{np}\mathrel:=\\{fontfil}{\up}.\\{twohalves}.\\{rhword}
$;
\2$\\{m}\mathrel:=(\\{fl}-\\{lh}-\\{ec}+\\{bc}-7)$;


\note This code is used in section 59.


\secbegin \6Read HEADER. Set \\{metricscale} and \\{fbt} and also
corresponding entries in \\{fcksum}, \\{fmag},
\\{fpfi} and \\{fpfb}{ \:m61\7} \.=\par
\pascal
\2$\\{get}(\\{fontfil})$;
\2$\\{fcksum}[\\{fyl}]\mathrel:=\\{fontfil}{\up}.\\{int}
\mathbin{\&{div}}20\mathopen{\hbox{B}}$;\40\ $\{\;$checksum is 32 leftmost bits, \TEX\ always
			handles 32 rightmost bits$\;\}$
\2$\\{get}(\\{fontfil})$;
\2$\\{dsize}\mathrel:=(\\{fontfil}{\up}.\\{int}\mathbin{\&{div}}20\mathopen{\hbox{B}}
)
/4000000\mathopen{\hbox{B}}
$;\40\ $\{\;$design size (always positive)$\;\}$
\2\1\&{if} $\\{atclause}$ \&{then}
\0$\\{metricscale}\mathrel:=\\{psize}$\3
\2\&{else} \0$\\{metricscale}\mathrel:=\\{dsize}$
;
\2$\\{fmag}[\\{fyl}]\mathrel:=\\{trunc}(1000.0{\ast}\\{metricscale}/\\{dsize})
$;\40\ $\{\;$font magnification with respect to design size$\;\}$
\2\1\&{for} $\\{i}\mathrel:=1\mathrel{\&{to}}10$ \&{do}
\0$\\{get}(\\{fontfil})$\3
;\40\ $\{\;$throw away character coding scheme$\;\}$
\2\1\&{for} $\\{i}\mathrel:=1\mathrel{\&{to}}5$ \&{do}
\2\&{begin} \0$\\{get}(\\{fontfil})$;
\0$\\{fpfi}[\\{fyl},\45\\{i}]\mathrel:=\\{fontfil}{\up}
.\\{fourbytes}$;
\2\&{end}\3
;\40\ $\{\;$Parc Font Id$\;\}$
\2$\\{get}(\\{fontfil})$;
\2$\\{fbt}\mathrel:=\\{fontfil}{\up}$;
\2$\\{fpfb}[\\{fyl}]\mathrel:=\\{fbt}.\\{fourbytes}.\\{byte3}
$;\40\ $\{\;$Parc Face Byte$\;\}$
\2\1\&{for} $\\{i}\mathrel:=1\mathrel{\&{to}}(\\{lh}-18)$ \&{do}
\0$\\{get}(\\{fontfil})$\3
;\40\ $\{\;$throw away rest of header$\;\}$


\note This code is used in section 59.

\secbegin \6Set \\{fontinfo} using the FINFO part of the file{ \:m62\7} \.=\par
\pascal
\2$\\{fbt}.\\{int}\mathrel:=0$;\40\ $\{\;$BEWARE: used to clear all fields of a \\{fontinfo} entry in a PDP-10$\;\}$
\2$\\{fc}\mathrel:=0$;
\2$\\{lc}\mathrel:=127$;\40\ $\{\;$the range that \TEX\ wants$\;\}$
\40\ $\{\;$The font goes from [\\{bc},\\{ec}], while \TEX\ wants the range [\\{fc},\\{lc}].
	The following code throws away font information for existing characters
	outside the \TEX\ range, defaults \\{fontinfo} to zero for
	nonexistent characters inside the \TEX\ range, and reads in the
	font information for existing characters in the \TEX\ range$\;\}$
\2\1\&{for} $\\{i}\mathrel:=\\{bc}\mathrel{\&{to}}\\{intmin}(\\{ec},\45\\{fc}-1)
$ \&{do}
\0$\\{get}(\\{fontfil})$\3
;
\2\1\&{for} $\\{i}\mathrel:=\\{fc}\mathrel{\&{to}}\\{intmin}(\\{lc},\45\\{bc}-1)
$ \&{do}
\0$\\{fontinfo}[\\{fyl},\45\\{i}-\\{fc}]\mathrel:=\\{fbt}
.\\{fourbytes}$\3
;
\2$\\{fbc}\mathrel:=\\{intmax}(\\{bc},\45\\{fc})$;
\2$\\{lec}\mathrel:=\\{intmin}(\\{ec},\45\\{lc})$;
\2\1\&{for} $\\{i}\mathrel:=\\{fbc}-\\{fc}\mathrel{\&{to}}(\\{fbc}-\\{fc}+\\{intmax}(\\{lec}-\\{fbc}+1,\450)-
1
)
$ \&{do}
\2\&{begin} \0$\\{get}(\\{fontfil})$;
\0$\\{fontinfo}[\\{fyl},\45\\{i}]\mathrel:=\\{fontfil}
{\up}.\\{fourbytes}$;\40\
$\{\;$BEWARE of field alignments$\;\}$
\2\&{end}\3
;
\2\1\&{for} $\\{i}\mathrel:=\\{intmax}(\\{lc}+1,\45\\{bc})\mathrel{\&{to}}
\\{ec}$ \&{do}
\0$\\{get}(\\{fontfil})$\3
;
\2\1\&{for} $\\{i}\mathrel:=\\{intmax}(\\{ec}+1,\45\\{fc})\mathrel{\&{to}}
\\{lc}$ \&{do}
\0$\\{fontinfo}[\\{fyl},\45\\{i}-\\{fc}]\mathrel:=\\{fbt}
.\\{fourbytes}$\3


\note This code is used in section 59.

\secbegin \6Load remaining tables{ \:m63\7} \.=\par
\pascal
\2\1\&{for} $\\{i}\mathrel:=\\{p}\mathrel{\&{to}}\\{p}+\\{m}-1$ \&{do}
\2\&{begin} \0$\\{get}(\\{fontfil})$;
\0$\\{fmem}[\\{i}]\mathrel:=\\{fontfil}{\up}$;\40\
$\{\;$BEWARE of field alignments$\;\}$
\2\&{end}\3
\3\2\1\&{define} \\{scale}\.{(\char'43)} $≡$ $\\{fmem}[\.{\char'43}].\\{pts}\mathrel:=((\\{fmem}[\.{\char'43}].\\{int}\mathbin{\&{div}}20\mathopen{\hbox{B}}
)
/
4000000\mathopen{\hbox{B}}
)
{\ast}
\\{metricscale}
$
\3\2\1\&{define} \\{funnyscale}\.{(\char'43)} $≡$ $\\{fmem}[\.{\char'43}].\\{pts}\mathrel:=((\\{fmem}[\.{\char'43}].\\{int}\mathbin{\&{div}}20\mathopen{\hbox{B}}
)
/
4000000\mathopen{\hbox{B}}
)
$

\note This code is used in section 59.

\secbegin \6Set entries in base arrays{ \:m64\7} \.=\par
\pascal
\2$\\{wdbase}[\\{fyl}]\mathrel:=\\{p}$;
\2$\\{htbase}[\\{fyl}]\mathrel:=\\{wdbase}[\\{fyl}]+\\{nw}
$;
\2$\\{dpbase}[\\{fyl}]\mathrel:=\\{htbase}[\\{fyl}]+\\{nh}
$;
\2$\\{icbase}[\\{fyl}]\mathrel:=\\{dpbase}[\\{fyl}]+\\{nd}
$;
\2$\\{lgbase}[\\{fyl}]\mathrel:=\\{icbase}[\\{fyl}]+\\{ni}
$;
\2$\\{krbase}[\\{fyl}]\mathrel:=\\{lgbase}[\\{fyl}]+\\{nl}
$;
\2$\\{extbase}[\\{fyl}]\mathrel:=\\{krbase}[\\{fyl}]+\\{nk}
$;
\2$\\{parbase}[\\{fyl}]\mathrel:=\\{extbase}[\\{fyl}]+
\\{ne}$;
\2\1\&{for} $\\{i}\mathrel:=0\mathrel{\&{to}}\\{nw}-1$ \&{do}
\0$\\{scale}(\\{wdbase}[\\{fyl}]+\\{i})$\3
;
\2\1\&{for} $\\{i}\mathrel:=0\mathrel{\&{to}}\\{nh}-1$ \&{do}
\0$\\{scale}(\\{htbase}[\\{fyl}]+\\{i})$\3
;
\2\1\&{for} $\\{i}\mathrel:=0\mathrel{\&{to}}\\{nd}-1$ \&{do}
\0$\\{scale}(\\{dpbase}[\\{fyl}]+\\{i})$\3
;
\2\1\&{for} $\\{i}\mathrel:=0\mathrel{\&{to}}\\{ni}-1$ \&{do}
\0$\\{scale}(\\{icbase}[\\{fyl}]+\\{i})$\3
;
\2\1\&{for} $\\{i}\mathrel:=0\mathrel{\&{to}}\\{nk}-1$ \&{do}
\0$\\{scale}(\\{krbase}[\\{fyl}]+\\{i})$\3
;
\2$\\{funnyscale}(\\{parbase}[\\{fyl}])$;\40\ $\{\;$slant: this is a pure number$\;\}$
\2\1\&{for} $\\{i}\mathrel:=1\mathrel{\&{to}}\\{np}-1$ \&{do}
\0$\\{scale}(\\{parbase}[\\{fyl}]+\\{i})$\3


\note This code is used in section 59.

\secbegin \head{Output routines}\par
These routines put DVI bytes in a system file. It is advisable to learn
about the format of \.{.DVI} files before reading the following code.
\pascal
\1\3\2\1\&{define} \\{onebyteSize} $=$ $\hbox{\char'16}400$
\3\2\1\&{define} \\{twobyteSize} $=$ $\hbox{\char'16}200000$
\3\2\1\&{define} \\{threebyteSize} $=$ $\hbox{\char'16}100000000$
\3\2\1\&{define} \\{rsusperpt} $≡$ $3514.598\null$\40\ $\{\;$number of rsu's per point: $1rsu=10↑{-7}meters$$\;\}$
$\null
$
\3\2\1\&{define} \\{convert}\.{(\char'43)} $≡$ $\\{trunc}((\.{\char'43}){\ast}\\{rsusperpt})$

\secbegin \6Globals in the outer block{ \:m15\7} \.{+=}\par
\pascal
\2$\\{dviword}\mathrel:\\{memoryword}$;\40\ $\{\;$pack output 4 bytes/word$\;\}$
\2$\\{bytenum}\mathrel:\\{integer}$;\40\ $\{\;$says which byte should be filled next$\;\}$
\3\2\1\&{define} \\{PST} $=$ $131$

\secbegin The procedures \\{DvI} and \\{IntOut} output one byte and one 32-bit word,
respectively.
\pascal
\1\3\2\1\1\&{procedure} $\\{DvI}(\\{byte}\mathrel:\\{integer})$;
\3\2\&{begin} \0\1\&{with} $\\{dviword}.\\{fourbytes}$ \&{do}
\2\1\&{case} $\\{bytenum}$ \&{of}
\2\11: \0$\\{byte0}\mathrel:=\\{byte}$\3;
\2\12: \0$\\{byte1}\mathrel:=\\{byte}$\3;
\2\13: \0$\\{byte2}\mathrel:=\\{byte}$\3;
\2\14: \0$\\{byte3}\mathrel:=\\{byte}$\3
\2\&{end}\3\3
;\40\
$\{\;$as many cases as \\{bytesPerWord}$\;\}$
\2$\\{Increment}(\\{bytenum})$;
\2\1\&{if} $\\{bytenum}>\\{bytesPerWord}$ \&{then}
\2\&{begin} \0$\\{outfil}{\up}\mathrel:=\\{dviword}.\\{int}$;
\0$\\{put}(\\{outfil})$;
\0$\\{bytenum}\mathrel:=1$;
\0$\\{dviword}.\\{int}\mathrel:=0$
\2\&{end}\3
\2\&{end};


\secbegin BEWARE: This procedure must be reprogrammed for 32 bit machines.
\pascal
\1\3\2\1\1\&{procedure} $\\{IntOut}(\\{i}\mathrel:\\{integer})$;\40\ $\{\;$32-bit precision$\;\}$
\3\2\1\&{var} $\\{highbyte}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{if} $\\{i}<0$ \&{then}
\0$\\{i}\mathrel:=\\{i}+\\{fourbytemask}$\3
;\40\
$\{\;$32-bit 2's complement of -i$\;\}$
\2$\\{highbyte}\mathrel:=\\{i}\mathbin{\&{div}}\\{threebyteSize}
$;\40\
$\{\;$\\{highbyte} has same sign as whole word$\;\}$
\2$\\{DvI}((\\{highbyte}+\\{onebyteSize})\mathbin{\&{mod}}\\{onebyteSize}
)
$;
\0$\\{i}\mathrel:=\\{i}+(-\\{highbyte}){\ast}\\{threebyteSize}
$;\40\
$\{\;$now all bits to the left of $24↑{th}$ are 0$\;\}$
\2$\\{DvI}((\\{i}\mathbin{\&{div}}\\{twobyteSize})\mathbin{\&{mod}}
\\{onebyteSize}
)
$;
\0$\\{DvI}((\\{i}\mathbin{\&{div}}\\{onebyteSize})\mathbin{\&{mod}}
\\{onebyteSize}
)
$;
\0$\\{DvI}(\\{i}\mathbin{\&{mod}}\\{onebyteSize})$;
\2\&{end};


\secbegin The procedure \\{CloseOut} generates the postamble of the output \.{.DVI} file.
It is system dependent because the postamble contains font file names.
\pascal
\1\3\2\1\1\&{procedure} $\\{CloseOut}(\\{dvibytecnt},\45\\{lastpageptr},\45\\{magnification}
\mathrel:
\\{integer}
;\42\,
\\{maxpageheight}
,\45
\\{maxpagewidth}
\mathrel:
\\{real}
;\42\,
\mathop{\&{var}}
\\{parbase}
,\45
\\{fcksum}
,\45
\\{fmag}
,\45
\\{fontused}
\mathrel:
\\{fbasearray}
)
$;\40\ $\{\;$just before \TEX\ stops, do this$\;\}$
\3\2\1\&{label} \0\\{continue};
\3\2\1\&{var} $\\{postambleptr},\45\\{f},\45\\{i}\mathrel:\\{integer}
$;
\2$\\{j}\mathrel:\\{asciiCode}$;
\3\2\&{begin} \0$\\{postambleptr}\mathrel:=\\{dvibytecnt}$;
\0$\\{DvI}(\\{PST})$;\40\
$\{\;$marks postamble$\;\}$
\2$\\{IntOut}(\\{lastpageptr})$;
\0$\\{IntOut}(1)$;
\0$\\{IntOut}(1)$;\40\
$\{\;$numerator and denominator of unit scale: no scaling
			is needed here because the program will output rsu's
			directly$\;\}$
\2$\\{IntOut}(\\{magnification})$;
\0$\\{IntOut}(\\{convert}(\\{maxpageheight}))$;
\0$\\{IntOut}(\\{convert}(\\{maxpagewidth}))$;
\2\1\&{for} $\\{f}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\1\&{if} $\\{fontused}[\\{f}]<>0$ \&{then}
\2\&{begin} \0$\\{IntOut}(\\{f})$;
\0$\\{IntOut}(\\{fcksum}[\\{f}])$;
\0$\\{IntOut}(\\{fmag}[\\{f}])$;
\0$\\{i}\mathrel:=0$;
\0$\\{j}\mathrel:=\\{fileName}[\\{f},\45\\{i}]$;
\2\1\&{while} $\\{j}<>\.{{\rm``}\ {\rm''}}$ \&{do}
\2\&{begin} \0$\\{Increment}(\\{i})$;
\0$\\{j}\mathrel:=\\{fileName}[\\{f},\45\\{i}]$
\2\&{end}\3
;
\2$\\{DvI}(\\{i})$;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{i}-1$ \&{do}
\0$\\{DvI}(\\{fileName}[\\{f},\45\\{j}])$\3
;
\2\&{end}\3
\3
;
\2$\\{IntOut}(-1)$;\40\
$\{\;$mark end of fonts$\;\}$
\2$\\{IntOut}(\\{postambleptr})$;
\0$\\{DvI}(1)$;\40\
$\{\;$DVI format version number$\;\}$
\2\1\&{for} $\\{i}\mathrel:=1\mathrel{\&{to}}10$ \&{do}
\0$\\{DvI}(223)$\3
;\40\
$\{\;$to ensure written buffer$\;\}$
\2$\\{reset}(\\{outfil})$;
\0$\\{reset}(\\{errfil})$;
\2\&{end};


\secbegin \head{Storing data structures}
 The following procedures are called from TEXPRE to write the tables
in a system file. Thus \TEX\ does not have to go through all the initialization,
it is enough to read the tables from that file. 
Notice that \\{tblfil} was declared of type array of \&{integer}.
This is the best way for PDP-10 PASCAL, but carries the assumption
that a \\{memoryword} takes the same space as an integer.
In installations where this is not true, \\{tblfil}
must be declared differently, perhaps with type \\{memoryword}.


\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{sizesarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}11]\mathop{\&{\ of }\!}
\\{integer}$;
\2$\\{memarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{memsize}]
\mathop{\&{\ of }\!}
\\{memoryword}$;
\2$\\{eqtbarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{eqtbsize}-1]
\mathop{\&{\ of }\!}
\\{memoryword}
$;
\2$\\{hasharray}=\mathop{\&{array }}[\\{locs}\mathrel{\!.\,.\!}\\{hashsize}]
\mathop{\&{\ of }\!}
\\{halves2}
$;
\2$\\{hheadarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{hprime}-1]
\mathop{\&{\ of }\!}
\\{integer}$;
\2$\\{pagememarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{pagememsize}-1]
\mathop{\&{\ of }\!}
\\{real}
$;
\2$\\{delimarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}127]\mathop{\&{\ of }\!}
\\{bytes4}$;
\3\2\1\1\&{procedure} $\\{SetTableSizes}$;
\3\2\&{begin} \0$\\{rewrite}(\\{tblfil},\45\\{tblfilnam},\450,\45\\{libraryarea}
)
$;
\0$\\{tblfil}{\up}\mathrel:=\\{secondmem}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{memsize}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{hashsize}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{hprime}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{eqtbsize}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{excepsize}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{sufsize}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{prefsize}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{btabsize}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{pagememsize}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{fmemsize}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{locs}$;
\0$\\{put}(\\{tblfil})$;
\2\&{end};
\3\2\1\1\&{procedure} $\\{WriteSecondMem}(\mathop{\&{var}}\\{mem}\mathrel:\\{memarray})
$;
\3\2\1\&{var} $\\{j}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=\\{secondmem}\mathrel{\&{to}}\\{memsize}
$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{mem}[\\{j}].\\{int}$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
\2\&{end};
\3\2\1\1\&{procedure} $\\{WriteEqTb}(\mathop{\&{var}}\\{eqtb}\mathrel:\\{eqtbarray};\42\,
\mathop{\&{var}}
\\{hash}
\mathrel:
\\{hasharray}
;\42\,
\mathop{\&{var}}
\\{hhead}
\mathrel:
\\{hheadarray}
;\42\,
\mathop{\&{var}}
\\{hashpar}
\mathrel:
\\{integer}
;\42\,
\mathop{\&{var}}
\\{hashsend}
\mathrel:
\\{integer}
)
$;\40\ $\{\;$writes-out original contents of equivalents and related tables$\;\}$
\3\2\1\&{var} $\\{j}\mathrel:\\{integer}$;
\2$\\{mword}\mathrel:\\{memoryword}$;\40\ $\{\;$used in writing the hash table out$\;\}$
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=\\{locs}\mathrel{\&{to}}\\{hashsize}
$ \&{do}
\2\&{begin} \0$\\{mword}.\\{twohalves}\mathrel:=\\{hash}[\\{j}]$;
\0$\\{tblfil}{\up}\mathrel:=\\{mword}.\\{int}$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{hprime}-1$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{hhead}[\\{j}]$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{eqtbsize}-1$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{eqtb}[\\{j}].\\{int}$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2$\\{tblfil}{\up}\mathrel:=\\{hashpar}$;
\0$\\{put}(\\{tblfil})$;
\0$\\{tblfil}{\up}\mathrel:=\\{hashsend}$;
\0$\\{put}(\\{tblfil})$
\2\&{end};
\3\2\1\1\&{procedure} $\\{WriteHyphenTb}(\mathop{\&{var}}\\{readoutVariable}\mathrel:\\{tableReadoutType}
;\42\,
\mathop{\&{var}}
\\{exceptable}
\mathrel:
\\{excparray}
;\42\,
\mathop{\&{var}}
\\{excephyph}
\mathrel:
\\{excphyarray}
;\42\,
\mathop{\&{var}}
\\{suffix}
\mathrel:
\\{suffixarray}
;\42\,
\mathop{\&{var}}
\\{prefix}
\mathrel:
\\{prefixarray}
;\42\,
\mathop{\&{var}}
\\{btable}
\mathrel:
\\{barray}
)
$;\40\ $\{\;$reads-in hyphenation tables$\;\}$
\3\2\1\&{var} $\\{j},\45\\{k}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{with} $\\{readoutVariable}$ \&{do}
\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{excepsize}-1$ \&{do}
\2\&{begin} \0$\\{excptableVariant}\mathrel:=\\{exceptable}[\\{j}]
$;
\2\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{exceptableEntryLength}
$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{readoutVariant}[\\{k}]$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=1\mathrel{\&{to}}\\{excepsize}-1$ \&{do}
\2\&{begin} \0$\\{excephyphVariant}\mathrel:=\\{excephyph}[\\{j}]$;
\2\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{excephyphEntryLength}
$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{readoutVariant}[\\{k}]$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{sufsize}-1$ \&{do}
\2\&{begin} \0$\\{suffixVariant}\mathrel:=\\{suffix}[\\{j}]$;
\2\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{suffixEntryLength}
$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{readoutVariant}[\\{k}]$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{prefsize}-1$ \&{do}
\2\&{begin} \0$\\{prefixVariant}\mathrel:=\\{prefix}[\\{j}]$;
\2\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{prefixEntryLength}
$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{readoutVariant}[\\{k}]$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=2\mathrel{\&{to}}\\{btabsize}+1$ \&{do}
\2\&{begin} \0$\\{btableVariant}\mathrel:=\\{btable}[\\{j}]$;
\2\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{btableEntryLength}
$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{readoutVariant}[\\{k}]$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\&{end}\3
;
\2\&{end}\3
;
\2\&{end};
\3\2\1\1\&{procedure} $\\{WritePageTb}(\mathop{\&{var}}\\{pagemem}\mathrel:\\{pagememarray}
)
$;\40\ $\{\;$writes-out original contents of page memory$\;\}$
\3\2\1\&{var} $\\{mword}\mathrel:\\{memoryword}$;
\2$\\{j}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{pagememsize}-1$ \&{do}
\2\&{begin} \0$\\{mword}.\\{pts}\mathrel:=\\{pagemem}[\\{j}]$;
\0$\\{tblfil}{\up}\mathrel:=\\{mword}.\\{int}$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\&{end};
\3\2\1\1\&{procedure} $\\{WriteDelimTb}(\mathop{\&{var}}\\{delimtable}\mathrel:\\{delimarray}
)
$;\40\ $\{\;$writes-out original contents of delimiters table$\;\}$
\3\2\1\&{var} $\\{j}\mathrel:\\{integer}$;
\2$\\{delim}\mathrel:\\{memoryword}$;
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}127$ \&{do}
\2\&{begin} \0$\\{delim}.\\{fourbytes}\mathrel:=\\{delimtable}[\\{j}]
$;
\0$\\{tblfil}{\up}\mathrel:=\\{delim}.\\{int}$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\&{end};
\3\2\1\1\&{procedure} $\\{WriteFMem}(\mathop{\&{var}}\\{fmem}\mathrel:\\{fmemarray};\42\,
\mathop{\&{var}}
\\{wdbase}
,\45
\\{htbase}
,\45
\\{dpbase}
,\45
\\{icbase}
,\45
\\{lgbase}
,\45
\\{krbase}
,\45
\\{extbase}
,\45
\\{parbase}
\mathrel:
\\{fbasearray}
;\42\,
\mathop{\&{var}}
\\{fontinfo}
\mathrel:
\\{fntinfoarray}
;\42\,
\mathop{\&{var}}
\\{fcksum}
,\45
\\{fpfb}
,\45
\\{fmag}
\mathrel:
\\{fbasearray}
;\42\,
\mathop{\&{var}}
\\{fpfi}
\mathrel:
\\{fpfiarray}
;\42\,
\mathop{\&{var}}
\\{fmemptr}
\mathrel:
\\{integer}
)
$;\40\ $\{\;$writes-out original contents of font memory$\;\}$
\3\2\1\&{var} $\\{mword}\mathrel:\\{memoryword}$;
\2$\\{j},\45\\{k}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{fmemsize}-1$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{fmem}[\\{j}].\\{int}$;
\0$\\{put}(\\{tblfil})$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{wdbase}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{htbase}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{dpbase}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{icbase}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{lgbase}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{krbase}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{extbase}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{parbase}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\1\&{for} $\\{k}\mathrel:=0\mathrel{\&{to}}\\{charsperfont}-1$ \&{do}
\2\&{begin} \0$\\{mword}.\\{fourbytes}\mathrel:=\\{fontinfo}[\\{j},\45\\{k}]
$;
\0$\\{tblfil}{\up}\mathrel:=\\{mword}.\\{int}$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{fcksum}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{fpfb}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{tblfil}{\up}\mathrel:=\\{fmag}[\\{j}]$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}5$ \&{do}
\2\&{begin} \0$\\{mword}.\\{fourbytes}\mathrel:=\\{fpfi}[\\{j},\45\\{k}]
$;
\0$\\{tblfil}{\up}\mathrel:=\\{mword}.\\{int}$;
\0$\\{put}(\\{tblfil})$;
\2\&{end}\3
\3
;
\2$\\{tblfil}{\up}\mathrel:=\\{fmemptr}$;
\0$\\{put}(\\{tblfil})$
\2\&{end};


\secbegin \head{Retrieving data structures}
 The procedures below are called from the main \TEX\ module to read-in the
tables previously generated by \&{TEXPRE}.
\pascal
\1\3\2\1\1\&{function} $\\{GetTableSizes}(\mathop{\&{var}}\\{sizestable}\mathrel:\\{sizesarray}
)
\mathrel:\\{boolean}$;
\3\2\1\&{var} $\\{j}\mathrel:\\{integer}$;
\3\2\&{begin} \0$\\{reset}(\\{tblfil},\45\\{tblfilnam},\450,\45\\{libraryarea}
)
$;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}11$ \&{do}
\2\&{begin} \0$\\{sizestable}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2$\\{GetTableSizes}\mathrel:=\mathop{\&{not }\!}\\{eof}
(\\{tblfil})$
\2\&{end};
\3\2\1\1\&{procedure} $\\{InitSecondMem}(\mathop{\&{var}}\\{mem}\mathrel:\\{memarray})
$;
\3\2\1\&{var} $\\{j}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=\\{secondmem}\mathrel{\&{to}}\\{memsize}
$ \&{do}
\2\&{begin} \0$\\{mem}[\\{j}].\\{int}\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
\2\&{end};
\3\2\1\1\&{procedure} $\\{InitEqTb}(\mathop{\&{var}}\\{eqtb}\mathrel:\\{eqtbarray};\42\,
\mathop{\&{var}}
\\{hash}
\mathrel:
\\{hasharray}
;\42\,
\mathop{\&{var}}
\\{hhead}
\mathrel:
\\{hheadarray}
;\42\,
\mathop{\&{var}}
\\{hashpar}
\mathrel:
\\{integer}
;\42\,
\mathop{\&{var}}
\\{hashsend}
\mathrel:
\\{integer}
)
$;\40\ $\{\;$reads-in original contents of equivalents and related tables$\;\}$
\3\2\1\&{var} $\\{j}\mathrel:\\{integer}$;
\2$\\{mword}\mathrel:\\{memoryword}$;\40\ $\{\;$used in reading the hash table in$\;\}$
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=\\{locs}\mathrel{\&{to}}\\{hashsize}
$ \&{do}
\2\&{begin} \0$\\{mword}.\\{int}\mathrel:=\\{tblfil}{\up}$;
\0$\\{hash}[\\{j}]\mathrel:=\\{mword}.\\{twohalves}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{hprime}-1$ \&{do}
\2\&{begin} \0$\\{hhead}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{eqtbsize}-1$ \&{do}
\2\&{begin} \0$\\{eqtb}[\\{j}].\\{int}\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2$\\{hashpar}\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\0$\\{hashsend}\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end};
\3\2\1\1\&{procedure} $\\{InitPageTb}(\mathop{\&{var}}\\{pagemem}\mathrel:\\{pagememarray}
)
$;\40\ $\{\;$reads-in original contents of page memory$\;\}$
\3\2\1\&{var} $\\{mword}\mathrel:\\{memoryword}$;
\2$\\{j}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{pagememsize}-1$ \&{do}
\2\&{begin} \0$\\{mword}.\\{int}\mathrel:=\\{tblfil}{\up}$;
\0$\\{pagemem}[\\{j}]\mathrel:=\\{mword}.\\{pts}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2\&{end};
\3\2\1\1\&{procedure} $\\{InitDelimTb}(\mathop{\&{var}}\\{delimtable}\mathrel:\\{delimarray}
)
$;\40\ $\{\;$reads-in original contents of delimiters table$\;\}$
\3\2\1\&{var} $\\{j}\mathrel:\\{integer}$;
\2$\\{delim}\mathrel:\\{memoryword}$;
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}127$ \&{do}
\2\&{begin} \0$\\{delim}.\\{int}\mathrel:=\\{tblfil}{\up}$;
\0$\\{delimtable}[\\{j}]\mathrel:=\\{delim}.\\{fourbytes}
$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2\&{end};
\3\2\1\1\&{procedure} $\\{InitFMem}(\mathop{\&{var}}\\{fmem}\mathrel:\\{fmemarray};\42\,
\mathop{\&{var}}
\\{wdbase}
,\45
\\{htbase}
,\45
\\{dpbase}
,\45
\\{icbase}
,\45
\\{lgbase}
,\45
\\{krbase}
,\45
\\{extbase}
,\45
\\{parbase}
\mathrel:
\\{fbasearray}
;\42\,
\mathop{\&{var}}
\\{fontinfo}
\mathrel:
\\{fntinfoarray}
;\42\,
\mathop{\&{var}}
\\{fcksum}
,\45
\\{fpfb}
,\45
\\{fmag}
\mathrel:
\\{fbasearray}
;\42\,
\mathop{\&{var}}
\\{fpfi}
\mathrel:
\\{fpfiarray}
;\42\,
\mathop{\&{var}}
\\{fmemptr}
\mathrel:
\\{integer}
)
$;\40\ $\{\;$reads-in original contents of font memory$\;\}$
\3\2\1\&{var} $\\{mword}\mathrel:\\{memoryword}$;
\2$\\{j},\45\\{k}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{fmemsize}-1$ \&{do}
\2\&{begin} \0$\\{fmem}[\\{j}].\\{int}\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{wdbase}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{htbase}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{dpbase}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{icbase}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{lgbase}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{krbase}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{extbase}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{parbase}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\1\&{for} $\\{k}\mathrel:=0\mathrel{\&{to}}\\{charsperfont}-1$ \&{do}
\2\&{begin} \0$\\{mword}.\\{int}\mathrel:=\\{tblfil}{\up}$;
\0$\\{fontinfo}[\\{j},\45\\{k}]\mathrel:=\\{mword}.\\{fourbytes}
$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{fcksum}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{fpfb}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\&{begin} \0$\\{fmag}[\\{j}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{maxfnt}$ \&{do}
\2\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}5$ \&{do}
\2\&{begin} \0$\\{mword}.\\{int}\mathrel:=\\{tblfil}{\up}$;
\0$\\{fpfi}[\\{j},\45\\{k}]\mathrel:=\\{mword}.\\{fourbytes}
$;
\0$\\{get}(\\{tblfil})$;
\2\&{end}\3
\3
;
\2$\\{fmemptr}\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$;
\2\&{end};
\3\2\1\&{define} \\{maximumDistinctionLength} $=$ $12\null$\40\ $\{\;$maximum number of characters needed to distinguish an exception$\;\}$
$\null
$
\3\2\1\&{define} \\{maximumExceptionLength} $=$ $16\null$\40\ $\{\;$longest word in the exception table (counting alpha only)$\;\}$
$\null
$
\3\2\1\&{define} \\{hashlength} $=$ $7\null$\40\ $\{\;$length of word used for hashing$\;\}$
$\null
$
\3\2\1\&{define} \\{shortAsciiType} $≡$ $0\mathrel{\!.\,.\!}31\null$\40\ $\{\;$titles for types (5 bits each)$\;\}$
$\null
$
\3\2\1\&{define} \\{excepword} $≡$ $\mathop{\&{array }}[1\mathrel{\!.\,.\!}\\{maximumDistinctionLength}]
\mathop{\&{\ of }\!}
\\{shortAsciiType}
\null$\40\ $\{\;$an entry in the exception table --- used to check whether a word is an
   exception to the hyphenation algorithm used; \\{exceptable} entries consist
   of enough characters --- at most \\{maximumDistinctionLength} ---
   to uniquely identify the exception$\;\}$
$\null
$
\3\2\1\&{define} \\{consonantPairEntry} $≡$ $\null$\1\2\&{record} \0$\\{hchar}\mathrel:0\mathrel{\!.\,.\!}7$;
\2$\\{weak}\mathrel:0\mathrel{\!.\,.\!}7$;
\2$\\{alphaset}\mathrel:\\{packedAlphas}$\2\&{end}$\null\3
$
\3\2\1\&{define} \\{shortAsciiAlphas} $≡$ $0\mathrel{\!.\,.\!}26$

\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{exception}=\mathop{\&{packed }\!}\\{excepword}$;
\2$\\{hyphenbits}=\mathop{\&{set}\!}\mathop{\&{\ of }\!}
1\mathrel{\!.\,.\!}\\{maximumExceptionLength}$;
\2$\\{packedHyphenbits}=\mathop{\&{packed }\!}\mathop{\&{set}\!}\mathop{\&{\ of }\!}
1\mathrel{\!.\,.\!}
\\{maximumExceptionLength}$;
\2$\\{packedAlphas}=\mathop{\&{packed }\!}\mathop{\&{set}\!}\mathop{\&{\ of }\!}
\\{shortAsciiAlphas}$;
\2$\\{packedConsonantPairEntry}=\mathop{\&{packed }\!}
\\{consonantPairEntry}$;\40\ $\{\;$bit string used to represent hyphenation points in a word$\;\}$
\2$\\{opcode}=0\mathrel{\!.\,.\!}15$;\40\ $\{\;$4 bit opcode$\;\}$
\2$\\{truthx}=\\{eightbits}$;\40\ $\{\;$8 bit true/false fields$\;\}$
\2$\\{hoperand}=\\{eightbits}$;\40\ $\{\;$8 bit operand field$\;\}$
\2$\\{suffixtp}=\mathop{\&{packed }\!}\null$\1\2\&{record} \0$\\{code}\mathrel:\\{opcode}$;
\2\1\&{case} $\\{oneOfTwo}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{truex}\mathrel:\\{truthx}$;
\2$\\{falsex}\mathrel:\\{truthx}$;
\2$\\{oprand}\mathrel:\\{hoperand}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{alphaset}\mathrel:\\{packedAlphas}$)
\3\3\2\&{end}$\null\3
$;
\2$\\{prefixtp}=\\{suffixtp}$;
\2$\\{tableReadoutType}=\null$\1\2\&{record} \0\1\&{case} $\\{oneOfSix}$ \&{of}
\2\1$1\mathrel:\null$
(\0$\\{excptableVariant}\mathrel:\\{exception}$)
\3;
\2\1$2\mathrel:\null$
(\0$\\{excephyphVariant}\mathrel:\\{packedHyphenbits}$)
\3;
\2\1$3\mathrel:\null$
(\0$\\{suffixVariant}\mathrel:\\{suffixtp}$)
\3;
\2\1$4\mathrel:\null$
(\0$\\{prefixVariant}\mathrel:\\{prefixtp}$)
\3;
\2\1$5\mathrel:\null$
(\0$\\{btableVariant}\mathrel:\\{packedConsonantPairEntry}
$)
\3;
\2\1$6\mathrel:\null$
(\0$\\{readoutVariant}\mathrel:\mathop{\&{array }}[1\mathrel{\!.\,.\!}\\{readoutsize}]
\mathop{\&{\ of }\!}
\\{integer}
$)
\3\3\2\&{end}$\null\3
$;


\secbegin \6Types in the outer block{ \:m5\7} \.{+=}\par
\pascal
\2$\\{excparray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{excepsize}-1]
\mathop{\&{\ of }\!}
\\{exception}
$;
\2$\\{excphyarray}=\mathop{\&{array }}[1\mathrel{\!.\,.\!}\\{excepsize}-1]
\mathop{\&{\ of }\!}
\\{packedHyphenbits}
$;
\2$\\{suffixarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{sufsize}-1]
\mathop{\&{\ of }\!}
\\{suffixtp}
$;
\2$\\{prefixarray}=\mathop{\&{array }}[0\mathrel{\!.\,.\!}\\{prefsize}-1]
\mathop{\&{\ of }\!}
\\{prefixtp}
$;
\2$\\{barray}=\mathop{\&{array }}[2\mathrel{\!.\,.\!}\\{btabsize}+1]
\mathop{\&{\ of }\!}
\\{packedConsonantPairEntry}
$;
\3\2\1\1\&{procedure} $\\{InitHyphenTb}(\mathop{\&{var}}\\{readoutVariable}\mathrel:\\{tableReadoutType}
;\42\,
\mathop{\&{var}}
\\{exceptable}
\mathrel:
\\{excparray}
;\42\,
\mathop{\&{var}}
\\{excephyph}
\mathrel:
\\{excphyarray}
;\42\,
\mathop{\&{var}}
\\{suffix}
\mathrel:
\\{suffixarray}
;\42\,
\mathop{\&{var}}
\\{prefix}
\mathrel:
\\{prefixarray}
;\42\,
\mathop{\&{var}}
\\{btable}
\mathrel:
\\{barray}
)
$;\40\ $\{\;$reads-in hyphenation tables$\;\}$
\3\2\1\&{var} $\\{j},\45\\{k}\mathrel:\\{integer}$;
\3\2\&{begin} \0\1\&{with} $\\{readoutVariable}$ \&{do}
\2\&{begin} \0\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{excepsize}-1$ \&{do}
\2\&{begin} \0\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{exceptableEntryLength}
$ \&{do}
\2\&{begin} \0$\\{readoutVariant}[\\{k}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2$\\{exceptable}[\\{j}]\mathrel:=\\{excptableVariant}
$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=1\mathrel{\&{to}}\\{excepsize}-1$ \&{do}
\2\&{begin} \0\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{excephyphEntryLength}
$ \&{do}
\2\&{begin} \0$\\{readoutVariant}[\\{k}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2$\\{excephyph}[\\{j}]\mathrel:=\\{excephyphVariant}$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{sufsize}-1$ \&{do}
\2\&{begin} \0\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{suffixEntryLength}
$ \&{do}
\2\&{begin} \0$\\{readoutVariant}[\\{k}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2$\\{suffix}[\\{j}]\mathrel:=\\{suffixVariant}$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=0\mathrel{\&{to}}\\{prefsize}-1$ \&{do}
\2\&{begin} \0\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{prefixEntryLength}
$ \&{do}
\2\&{begin} \0$\\{readoutVariant}[\\{k}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2$\\{prefix}[\\{j}]\mathrel:=\\{prefixVariant}$
\2\&{end}\3
;
\2\1\&{for} $\\{j}\mathrel:=2\mathrel{\&{to}}\\{btabsize}+1$ \&{do}
\2\&{begin} \0\1\&{for} $\\{k}\mathrel:=1\mathrel{\&{to}}\\{btableEntryLength}
$ \&{do}
\2\&{begin} \0$\\{readoutVariant}[\\{k}]\mathrel:=\\{tblfil}{\up}$;
\0$\\{get}(\\{tblfil})$
\2\&{end}\3
;
\2$\\{btable}[\\{j}]\mathrel:=\\{btableVariant}$
\2\&{end}\3
;
\2\&{end}\3
;
\2\&{end};
\3\2\&{begin} \40\ $\{\;$The body of the SYSDEP module is empty$\;\}$
\2\&{end}.


\index
\\ASCII:12.
\\AppendToName:1, 54, 55, 56.
\\AppndReal:1, 22.
\\AppndString:1, 21.
\\B:12, 23, 37, 56, 61, 63.
\\ChanPtr:26, 39.
\\CloseOut:1, 69.
\\Close:1, 30, 55.
\\DSK:55.
\\DeclareOFil:1, 50.
\\Decrement:\&{11}, 37, 45, 56.
\\DvI:1, 67, 68, 69.
\\ERRORSTEM:12.
\\FOOBARTTY:12.
\\ForceBufferOut:1, 38.
\\GetChan:26, 39.
\\GetFirstLine:1, 40, 43.
\\GetTableSizes:1, 72.
\\InChTer:1, 32, 48.
\\InLnTer:1, 32, 48.
\\InLn:1, 39, 40, 42, 44.
\\Increment:\&{11}, 19, 20, 21, 22, 32, 36, 37, 38, 39, 44, 50, 55, 56, 67, 69.
\\InitDelimTb:1, 72.
\\InitEqTb:1, 72.
\\InitFMem:1, 72.
\\InitFileName:1, 53.
\\InitHyphenTb:1, 74.
\\InitPageTb:1, 72.
\\InitSecondMem:1, 72.
\\InitStrings:1, 19.
\\InitSysdep:1, 23.
\\IntOut:1, 68, 69.
\\LowerCase:\&{11}, 56.
\\OutChErr:1, 34, 49.
\\OutChTer:33, 47.
\\OutLnErr:1, 34.
\\PST:\&{66}, 69.
\\PTEXINTBL:12.
\\PrintFileName:1, 38.
\\PrintInt:1, 37, 44.
\\PrintLn:1, 36, 54.
\\PrintOctal:1, 37.
\\PrintReal:1, 37.
\\Print:1, 36, 37, 38, 40, 42, 44.
\\ProduceString:1, 20, 21.
\\ReadFontInfo:1, 59.
\\Release:1, 45.
\\RsetFile:26, 55.
\\RwriteFile:28, 55.
\\STRINITBL:12.
\\SendCh:1, 35.
\\SendLn:1, 35.
\\SendStarted:1, 29, 55.
\\SetTableSizes:1, 71.
\\TBL:12.
\\TEXOUTDVI:12.
\\TEX:53.
\\TFM:53.
\\TTY:13.
\\TraceLine:1, 46.
\\Unpack:20, 21, 22.
\\UpperCase:\&{11}, 50, 56.
\\WriteDelimTb:1, 71.
\\WriteEqTb:1, 71.
\\WriteFMem:1, 71.
\\WriteHyphenTb:1, 71.
\\WritePageTb:1, 71.
\\WriteSecondMem:1, 71.
\\alphaset:72, 73.
\\ascfilnam:\&{12}, 19.
\\asciiCode:11, 18, 19, 26, 31, 32, 33, 34, 35, 36, 37, 39, 40, 46, 50, 69.
\\asciiString:11, 20, 21, 22, 38, 50, 52.
\\ascii:15, 25, 27.
\\atclause:59, 61.
\\barray:71, 74.
\\bc:59, 60, 62.
\\boolean:19, 26, 29, 37, 39, 40, 50, 54, 59, 72.
\\brchar:32, 39, 40, 42, 44, 46, 48.
\\break:32, 38.
\\btableEntryLength:\&{4}, 71, 74.
\\btableVariant:71, 73, 74.
\\btable:71, 74.
\\btabsize:\&{4}, 71, 74.
\\bufPtr:32, 39, 40, 42, 44, 46, 47, 48.
\\buffer:32, 39, 40, 41, 42, 44, 46, 47, 48, 49.
\\buffir:31, 32, 39, 40, 46.
\\bufsize:\&{4}, 31, 32.
\\byte0:8, 67.
\\byte1:8, 67.
\\byte2:8, 67.
\\byte3:8, 61, 67.
\\bytenum:23, 66, 67.
\\bytes4:8, 58, 71.
\\bytesPerWord:\&{4}, 67.
\\byte:67.
\\carriagereturn:\&{6}, 19, 32, 34, 35, 36, 39, 47, 48.
\\char6:24, 26, 28, 50.
\\char9:24, 26, 28, 50, 52.
\\charcodes:\&{11}, 54.
\\charsperfont:\&{4}, 58, 59, 71, 72.
\\chartable:19.
\\char:24.
\\chr:32, 33, 34, 35, 36, 47, 50, 56.
\\ch:54, 56.
\\cmmd:54.
\\code:73.
\\consonantPairEntry:\&{72}, 73.
\\continue:\&{9}, 19, 69.
\\convert:\&{65}, 69.
\\c:19, 20, 32, 33, 34, 35, 36, 39, 50.
\\dangerousfont:\&{58}, 59.
\\delimarray:71, 72.
\\delimtable:71, 72.
\\delim:71, 72.
\\done:\&{9}, 10, 19, 40, 43, 50, 55, 59.
\\dpbase:59, 64, 71, 72.
\\dsize:59, 61.
\\dstring:21, 22.
\\dummyFont:\&{10}, 55.
\\dvibytecnt:69.
\\dviword:23, 66, 67.
\\d:21, 22.
\\ec:59, 60, 62.
\\eightbits:\&{7}, 8, 73.
\\eight:\&{6}, 37.
\\eofChan:26, 39, 55.
\\eoff:39, 40, 42, 43, 44.
\\eof:19, 26, 29, 55, 72.
\\eqtbarray:71, 72.
\\eqtbsize:\&{3}, 71, 72.
\\eqtb:71, 72.
\\errfilnam:\&{12}, 23.
\\errfil:15, 23, 34, 36, 47, 69.
\\excephyphEntryLength:\&{4}, 71, 74.
\\excephyphVariant:71, 73, 74.
\\excephyph:71, 74.
\\excepsize:\&{4}, 71, 74.
\\exceptableEntryLength:\&{4}, 71, 74.
\\exceptable:71, 74.
\\exception:73, 74.
\\excepword:\&{72}, 73.
\\excparray:71, 74.
\\excphyarray:71, 74.
\\excptableVariant:71, 73, 74.
\\extbase:59, 64, 71, 72.
\\extension:52, 56.
\\failure:\&{9}, 53, 55.
\\falsex:73.
\\false:19, 37, 39, 43, 50.
\\fbasearray:58, 59, 69, 71, 72.
\\fbc:59, 62.
\\fbt:59, 61, 62.
\\fcksum:59, 61, 69, 71, 72.
\\fc:59, 62.
\\fdevice:26, 28.
\\fdirectory:26, 28.
\\fdir:52, 53, 55, 56.
\\filPtr:15, 23, 45, 53, 55.
\\fileName:15, 20, 21, 22, 23, 38, 50, 55, 69.
\\filetype:52, 53, 55, 56.
\\filnam:\&{10}, 20, 21, 22.
\\fil:52, 53, 55.
\\first:46, 47, 48, 49.
\\five:\&{6}, 37.
\\fj:52, 53, 55, 56.
\\fl:59, 60.
\\fmag:59, 61, 69, 71, 72.
\\fmemarray:58, 59, 71, 72.
\\fmemoverflow:\&{58}, 59.
\\fmemptr:59, 71, 72.
\\fmemsize:\&{4}, 58, 59, 71, 72.
\\fmem:59, 63, 71, 72.
\\fname:26, 28, 52, 53, 55, 56.
\\fnl:52, 53, 55, 56.
\\fnstate:52, 53, 55, 56.
\\fnstring:52, 53, 55, 56.
\\fntinfoarray:58, 59, 71, 72.
\\fnum:53.
\\fontfile:52, 53, 55, 56.
\\fontfil:15, 55, 60, 61, 62, 63.
\\fontinfo:59, 62, 71, 72.
\\fontused:69.
\\formfeed:\&{6}, 19, 39, 42, 44.
\\fourbyteSize:23.
\\fourbytemask:15, 23, 68.
\\fourbytes:8, 61, 62, 67, 71, 72.
\\four:\&{6}, 37.
\\fpfb:59, 61, 71, 72.
\\fpfiarray:58, 59, 71, 72.
\\fpfi:59, 61, 71, 72.
\\fprgmr:52, 53, 55, 56.
\\funnyscale:\&{63}, 64.
\\fyl:38, 39, 40, 42, 44, 45, 50, 59, 61, 62, 64.
\\f:69.
\\get:19, 26, 32, 48, 60, 61, 62, 63, 72, 74.
\\halves2:8, 71.
\\hasharray:71, 72.
\\hashpar:71, 72.
\\hashsend:71, 72.
\\hashsize:\&{3}, 3, 71, 72.
\\hash:71, 72.
\\hchar:72.
\\hheadarray:71, 72.
\\hhead:71, 72.
\\highbyte:68.
\\hoperand:73.
\\hprime:\&{3}, 71, 72.
\\htbase:59, 64, 71, 72.
\\hyphenbits:73.
\\icbase:59, 64, 71, 72.
\\ichan1:19, 25, 26, 45.
\\ichan2:25, 26, 45.
\\ichan3:25, 26, 45.
\\ichan4:25, 26, 45.
\\ichan5:25, 26, 45.
\\ichan6:25, 26, 45.
\\id:26, 28.
\\inputFile:\&{10}, 53.
\\inputfile:52, 53, 55.
\\integer:8, 15, 16, 18, 20, 21, 22, 23, 26, 28, 29, 30, 32, 35, 36, 37, 38, 39, 40, 45, 46, 50, 52, 53, 54, 58, 59, 66, 67, 68, 69, 71, 72, 73, 74.
\\intmax:16, 62.
\\intmin:16, 62.
\\int:8, 23, 59, 61, 62, 63, 67, 71, 72.
\\i:20, 21, 22, 23, 36, 37, 38, 50, 59, 61, 62, 63, 64, 68, 69.
\\jj:54.
\\j:20, 21, 22, 46, 47, 49, 50, 69, 71, 72, 74.
\\krbase:59, 64, 71, 72.
\\k:37, 71, 72, 74.
\\lastpageptr:69.
\\last:46, 47, 48, 49.
\\lc:59, 62.
\\lec:59, 62.
\\lgbase:59, 64, 71, 72.
\\lhword:8, 60.
\\lh:59, 60, 61.
\\libraryarea:\&{12}, 19, 55, 71, 72.
\\lineEnd:\&{32}, 32, 39.
\\linefeed:\&{6}, 19, 34, 35, 36, 39, 47, 48.
\\locs:\&{3}, 71, 72.
\\magnification:69.
\\malformedname:\&{9}, 54.
\\maxfil:\&{4}, 15.
\\maxfnt:\&{4}, 10, 58, 69, 71, 72.
\\maximumDistinctionLength:\&{72}, 72.
\\maximumExceptionLength:\&{72}, 73.
\\maxinfil:\&{4}, 4, 53.
\\maxint:23.
\\maxlinelength:\&{4}, 39.
\\maxpageheight:69.
\\maxpagewidth:69.
\\memarray:71, 72.
\\memoryword:8, 15, 58, 59, 66, 71, 72.
\\memsize:\&{2}, 71, 72.
\\mem:71, 72.
\\mes:36.
\\metricscale:59, 61, 63.
\\msb:37.
\\mword:71, 72.
\\m:16, 37, 59, 60, 63.
\\namepart:52, 53, 55, 56.
\\namestring:20.
\\nd:59, 60, 64.
\\needmore:\&{9}, 56.
\\ne:59, 60, 64.
\\nfonts:\&{4}, 4, 23, 53, 55.
\\nh:59, 60, 64.
\\nine:\&{6}, 37.
\\ni:59, 60, 64.
\\nk:59, 60, 64.
\\nl:59, 60, 64.
\\nodev:50.
\\np:59, 60, 64.
\\null:\&{6}, 19, 20, 21, 22, 23, 36, 38, 39, 50, 53, 55.
\\nw:59, 60, 64.
\\n:16, 37.
\\ochan0:27, 28, 29, 30, 35.
\\ochan1:27, 28, 29, 30, 35.
\\ochan2:27, 28, 29, 30, 35.
\\ochan3:27, 28, 29, 30, 35.
\\ochan4:27, 28, 29, 30, 35.
\\ochan5:27, 28, 29, 30, 35.
\\ochan6:27, 28, 29, 30, 35.
\\ochan7:27, 28, 29, 30, 35.
\\ochan8:27, 28, 29, 30, 35.
\\ochan9:27, 28, 29, 30, 35.
\\oldbrchar:46, 48.
\\oneOfFive:5.
\\oneOfFour:5, 8.
\\oneOfSix:5, 73.
\\oneOfTwo:5, 8, 73.
\\onebyteSize:\&{65}, 68.
\\one:\&{6}, 37, 40.
\\opcode:73.
\\oprand:73.
\\ord:19, 26, 32, 48.
\\otherchar:\&{11}, 11.
\\outdev:50.
\\outfilnam:\&{12}, 50.
\\outfil:15, 50, 67, 69.
\\outfylnam:50.
\\outputFile:\&{10}, 50.
\\packedAlphas:72, 73.
\\packedAsciiString:11, 15.
\\packedConsonantPairEntry:73, 74.
\\packedHyphenbits:73, 74.
\\pack:21, 22, 55.
\\pagememarray:71, 72.
\\pagememsize:\&{4}, 71, 72.
\\pagemem:71, 72.
\\page:40, 42, 44.
\\parbase:59, 64, 69, 71, 72.
\\poolinx:18, 19, 21, 22.
\\postambleptr:69.
\\prefixEntryLength:\&{4}, 71, 74.
\\prefixVariant:71, 73, 74.
\\prefixarray:71, 74.
\\prefixtp:73, 74.
\\prefix:71, 74.
\\prefsize:\&{4}, 71, 74.
\\problems:54.
\\programmer:52, 55, 56.
\\project:52, 56.
\\psize:59, 61.
\\pts:8, 63, 71, 72.
\\put:33, 34, 35, 36, 47, 67, 71.
\\p:59, 63, 64.
\\readoutVariable:71, 74.
\\readoutVariant:71, 73, 74.
\\readoutsize:\&{4}, 73.
\\real:8, 22, 37, 59, 69, 71.
\\reset:19, 26, 30, 32, 45, 55, 69, 72.
\\return:\&{9}, 53, 54, 56.
\\rewrite:23, 28, 50, 71.
\\rhword:8, 60.
\\round:37.
\\rsusperpt:\&{65}, 65.
\\scale:\&{63}, 64.
\\secondmem:\&{2}, 71, 72.
\\sendfile:52, 53, 55.
\\seven:\&{6}, 37.
\\shortAsciiAlphas:\&{72}, 73.
\\shortAsciiType:\&{72}, 72.
\\sixteenbits:\&{7}, 8.
\\six:\&{6}, 37.
\\sizesarray:71, 72.
\\sizestable:72.
\\skip:52, 56.
\\spacer:\&{11}, 54.
\\sstring:21, 22.
\\stream:29, 30, 35.
\\strfilnam:\&{12}, 19.
\\stringsize:\&{10}, 11, 50, 53, 56.
\\strnginx:18, 19, 21, 22.
\\strngpool:18, 19, 20, 21, 22, 36.
\\strng:18, 19, 20, 21, 22, 36.
\\suffixEntryLength:\&{4}, 71, 74.
\\suffixVariant:71, 73, 74.
\\suffixarray:71, 74.
\\suffixtp:73, 74.
\\suffix:71, 74.
\\sufsize:\&{4}, 71, 74.
\\sysdep:1.
\\s:21, 22, 37, 38, 50.
\\tableReadoutType:71, 73, 74.
\\tblfilnam:\&{12}, 71, 72.
\\tblfil:15, 71, 72, 74.
\\terDevice:13, 23, 32.
\\terIn:15, 32, 48.
\\terOut:15, 23, 32, 33, 36, 38, 47.
\\terfilnam:\&{12}, 23, 32.
\\texpars:\&{3}, 3.
\\threebyteSize:\&{65}, 68.
\\three:\&{6}, 37.
\\truex:73.
\\true:19, 37, 39, 40, 50.
\\trunc:22, 37, 61, 65.
\\truthx:73.
\\twobyteSize:\&{65}, 68.
\\twohalves:8, 60, 71, 72.
\\two:\&{6}, 37, 42.
\\unpack:38, 50.
\\wdbase:59, 64, 71, 72.
\\weak:72.
\\x:16, 37.
\\y:16.
\\zero:\&{6}, 37.
\endindex